Index: tests/concurrent/unified_locking/block_spin_lock.cfa
===================================================================
--- tests/concurrent/unified_locking/block_spin_lock.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
+++ tests/concurrent/unified_locking/block_spin_lock.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
@@ -0,0 +1,8 @@
+#include <locks.hfa>
+
+#define LOCK block_spin_lock
+#include "mutex_test.hfa"
+
+int main() {
+    test();
+}
Index: tests/concurrent/unified_locking/clh.cfa
===================================================================
--- tests/concurrent/unified_locking/clh.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
+++ tests/concurrent/unified_locking/clh.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
@@ -0,0 +1,8 @@
+#include <locks.hfa>
+
+#define LOCK clh_lock
+#include "mutex_test.hfa"
+
+int main() {
+    test();
+}
Index: tests/concurrent/unified_locking/cond_perf.cfa
===================================================================
--- tests/concurrent/unified_locking/cond_perf.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
+++ tests/concurrent/unified_locking/cond_perf.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
@@ -0,0 +1,57 @@
+#include "locks.hfa"
+
+
+fast_block_lock f;
+fast_cond_var( fast_block_lock ) f_c_f;
+condition_variable( fast_block_lock ) c_f;
+
+unsigned int num_times = 10000;
+
+thread T_F_C_F_WS1 {};
+
+void main( T_F_C_F_WS1 & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		lock(f);
+		if(empty(f_c_f) && i != num_times - 1) {
+			wait(f_c_f,f);
+		}else{
+			notify_one(f_c_f);
+			unlock(f);
+		}
+	}
+}
+
+thread T_C_F_WS1 {};
+
+void main( T_C_F_WS1 & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		lock(f);
+		if(empty(c_f) && i != num_times - 1) {
+			wait(c_f,f);
+		}else{
+			notify_one(c_f);
+			unlock(f);
+		}
+	}
+}
+
+int main(int argc, char* argv[]) {
+    int variation = 0;
+    switch (argc) {
+        case 3:
+            num_times =  atoi(argv[2]);
+        case 2:
+            variation = atoi(argv[1]);
+        case 1:
+            break;
+        default:
+            break;
+    }
+	processor p[1];
+    
+    if (variation == 0) {
+        T_F_C_F_WS1 t[2];
+    }else if (variation == 1) {
+        T_C_F_WS1 t[2];
+    }
+}
Index: tests/concurrent/unified_locking/exp_backoff.cfa
===================================================================
--- tests/concurrent/unified_locking/exp_backoff.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
+++ tests/concurrent/unified_locking/exp_backoff.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
@@ -0,0 +1,8 @@
+#include <locks.hfa>
+
+#define LOCK exp_backoff_then_block_lock
+#include "mutex_test.hfa"
+
+int main() {
+    test();
+}
Index: tests/concurrent/unified_locking/fast_block_lock.cfa
===================================================================
--- tests/concurrent/unified_locking/fast_block_lock.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
+++ tests/concurrent/unified_locking/fast_block_lock.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
@@ -0,0 +1,8 @@
+#include <locks.hfa>
+
+#define LOCK fast_block_lock
+#include "mutex_test.hfa"
+
+int main() {
+    test();
+}
Index: tests/concurrent/unified_locking/futex_mutex.cfa
===================================================================
--- tests/concurrent/unified_locking/futex_mutex.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
+++ tests/concurrent/unified_locking/futex_mutex.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
@@ -0,0 +1,8 @@
+#include <locks.hfa>
+
+#define LOCK futex_mutex
+#include "mutex_test.hfa"
+
+int main() {
+    test();
+}
Index: tests/concurrent/unified_locking/locks.cfa
===================================================================
--- tests/concurrent/unified_locking/locks.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
+++ tests/concurrent/unified_locking/locks.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
@@ -0,0 +1,348 @@
+#include <stdio.h>
+#include "locks.hfa"
+#include <stdlib.hfa>
+#include <thread.hfa>
+
+const unsigned int num_times = 50000;
+
+multiple_acquisition_lock m;
+condition_variable( multiple_acquisition_lock ) c_m;
+
+single_acquisition_lock s;
+condition_variable( single_acquisition_lock ) c_s;
+
+owner_lock o;
+condition_variable( owner_lock ) c_o;
+
+exp_backoff_then_block_lock l;
+condition_variable( exp_backoff_then_block_lock ) c_l;
+
+fast_block_lock f;
+fast_cond_var( fast_block_lock ) f_c_f;
+
+thread T_C_M_WS1 {};
+
+void main( T_C_M_WS1 & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		lock(m);
+		if(empty(c_m) && i != num_times - 1) {
+			wait(c_m,m);
+		}else{
+			notify_one(c_m);
+		}
+		unlock(m);
+	}
+}
+
+thread T_C_M_WB1 {};
+
+void main( T_C_M_WB1 & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		lock(m);
+		if(counter(c_m) == 3 || i == num_times - 1) {
+			notify_all(c_m);
+		}else{
+			wait(c_m,m);
+		}
+		unlock(m);
+	}
+}
+
+thread T_C_S_WS1 {};
+
+void main( T_C_S_WS1 & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		lock(s);
+		if(empty(c_s) && i != num_times - 1) {
+			wait(c_s,s);
+		}else{
+			notify_one(c_s);
+		}
+		unlock(s);
+	}
+}
+
+thread T_C_S_WB1 {};
+
+void main( T_C_S_WB1 & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		lock(s);
+		if(counter(c_s) == 3 || i == num_times - 1) {
+			notify_all(c_s);
+		}else{
+			wait(c_s,s);
+		}
+		unlock(s);
+	}
+}
+
+thread T_C_L_WS1 {};
+
+void main( T_C_L_WS1 & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		lock(l);
+		if(empty(c_l) && i != num_times - 1) {
+			wait(c_l,l);
+		}else{
+			notify_one(c_l);
+		}
+		unlock(l);
+	}
+}
+
+thread T_C_L_WB1 {};
+
+void main( T_C_L_WB1 & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		lock(l);
+		if(counter(c_l) == 3 || i == num_times - 1) {
+			notify_all(c_l);
+		}else{
+			wait(c_l,l);
+		}
+		unlock(l);
+	}
+}
+
+thread T_F_C_F_WS1 {};
+
+void main( T_F_C_F_WS1 & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		lock(f);
+		if(empty(f_c_f) && i != num_times - 1) {
+			wait(f_c_f,f);
+		}else{
+			notify_one(f_c_f);
+		}
+		unlock(f);
+	}
+}
+
+thread T_C_O_WS1 {};
+
+void main( T_C_O_WS1 & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		lock(o);
+		if(empty(c_o) && i != num_times - 1) {
+			wait(c_o,o);
+		}else{
+			notify_one(c_o);
+		}
+		unlock(o);
+	}
+}
+
+thread T_C_O_WB1 {};
+
+void main( T_C_O_WB1 & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		lock(o);
+		if(counter(c_o) == 3 || i == num_times - 1) {
+			notify_all(c_o);
+		}else{
+			wait(c_o,o);
+		}
+		unlock(o);
+	}
+}
+
+thread T_C_M_WS2 {};
+
+void main( T_C_M_WS2 & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		lock(m);
+		lock(m);
+		lock(m);
+		if(empty(c_m) && i != num_times - 1) {
+			wait(c_m,m);
+		}else{
+			notify_one(c_m);
+		}
+		unlock(m);
+		unlock(m);
+		unlock(m);
+	}
+}
+
+thread T_C_O_WS2 {};
+
+void main( T_C_O_WS2 & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		lock(o);
+		lock(o);
+		lock(o);
+		if(empty(c_o) && i != num_times - 1) {
+			wait(c_o,o);
+		}else{
+			notify_one(c_o);
+		}
+		unlock(o);
+		unlock(o);
+		unlock(o);
+	}
+}
+
+thread T_C_NLW {};
+
+void main( T_C_NLW & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		wait(c_o);
+	}
+}
+
+thread T_C_NLS {};
+
+void main( T_C_NLS & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		while (empty(c_o)) { }
+		notify_one(c_o);
+	}
+}
+
+thread T_C_S_WNF {};
+
+void main( T_C_S_WNF & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		lock(s);
+		if(empty(c_s) && i != num_times - 1) {
+			wait(c_s, s, 10);
+		}else{
+			if(!empty(c_s)) assert(front(c_s) == 10);
+			notify_one(c_s);
+		}
+		unlock(s);
+	}
+}
+
+bool done = false;
+
+thread T_C_NLWD {};
+
+void main( T_C_NLWD & this ) {
+	done = false;
+	for (unsigned int i = 0; i < num_times/5; i++) {
+		if (i % 1000 == 0) printf("Iteration: %d\n", i);
+		wait(c_s, 1`ns);
+	}
+	done = true;
+}
+
+thread T_C_WDS {};
+
+void main( T_C_WDS & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		while (empty(c_s) && !done) { }
+		notify_one(c_s);
+		sleep(1`ns);
+		if(done) break;
+	}
+}
+
+thread T_C_LWD {};
+
+void main( T_C_LWD & this ) {
+	done = false;
+	for (unsigned int i = 0; i < num_times/5; i++) {
+		if (i % 1000 == 0) printf("Iteration: %d\n", i);
+		lock(s);
+		wait(c_s, s, 1`ns);
+		unlock(s);
+	}
+	done = true;
+}
+
+thread T_C_LWDS {};
+
+void main( T_C_LWDS & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		while (empty(c_s) && !done) { }
+		lock(s);
+		notify_one(c_s);
+		unlock(s);
+		sleep(1`ns);
+		if(done) break;
+	}
+}
+
+int main() {
+	processor p[2];
+	printf("Start Test 1: multi acquisition lock and condition variable single wait/notify\n");
+	{
+		T_C_M_WS1 t1[2];
+	}
+	printf("Done Test 1\n");
+
+	printf("Start Test 2: multi acquisition lock and condition variable 3 wait/notify all\n");
+	{
+		T_C_M_WB1 t1[4];
+	}
+	printf("Done Test 2\n");
+
+	printf("Start Test 3: single acquisition lock and condition variable single wait/notify\n");
+	{
+		T_C_S_WS1 t1[2];
+	}
+	printf("Done Test 3\n");
+
+	printf("Start Test 4: single acquisition lock and condition variable 3 wait/notify all\n");
+	{
+		T_C_S_WB1 t1[4];
+	}
+	printf("Done Test 4\n");
+
+	printf("Start Test 5: owner lock and condition variable single wait/notify\n");
+	{
+		T_C_O_WS1 t1[2];
+	}
+	printf("Done Test 5\n");
+
+	printf("Start Test 6: owner lock and condition variable 3 wait/notify all\n");
+	{
+		T_C_O_WB1 t1[4];
+	}
+	printf("Done Test 6\n");
+
+	printf("Start Test 7: linear backoff lock and condition variable single wait/notify\n");
+	{
+		T_C_L_WS1 t1[2];
+	}
+	printf("Done Test 7\n");
+
+	printf("Start Test 8: linear backoff lock and condition variable 3 wait/notify all\n");
+	{
+		T_C_L_WB1 t1[4];
+	}
+	printf("Done Test 8\n");
+
+	printf("Start Test 9: multi acquisiton lock and condition variable multiple acquire and wait/notify\n");
+	{
+		T_C_M_WS2 t1[2];
+	}
+	printf("Done Test 9\n");
+
+	printf("Start Test 10: owner lock and condition variable multiple acquire and wait/notify\n");
+	{
+		T_C_O_WS2 t1[2];
+	}
+	printf("Done Test 10\n");
+
+	printf("Start Test 11: no lock condition variable wait/notify\n");
+	{
+		T_C_NLW t1;
+		T_C_NLS t2;
+	}
+	printf("Done Test 11\n");
+
+	printf("Start Test 12: locked condition variable wait/notify with front()\n");
+	{
+		T_C_S_WNF t1[2];
+	}
+	printf("Done Test 12\n");
+
+	printf("Start Test 13: fast block lock and fast cond var single wait/notify\n");
+	{
+		T_F_C_F_WS1 t1[2];
+	}
+	printf("Done Test 13\n");
+	
+}
Index: tests/concurrent/unified_locking/mcs.cfa
===================================================================
--- tests/concurrent/unified_locking/mcs.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
+++ tests/concurrent/unified_locking/mcs.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
@@ -0,0 +1,66 @@
+#include <fstream.hfa>
+#include <locks.hfa>
+#include <thread.hfa>
+
+const unsigned int num_times = 50000;
+
+struct MutexObj {
+	mcs_lock l;
+	thread$ * id;
+	size_t sum;
+};
+
+MutexObj mo;
+
+void trash() {
+	unsigned t[100];
+	for(i; 100) {
+		t[i] = 0xDEADBEEF;
+	}
+}
+
+unsigned cs() {
+	thread$ * me = active_thread();
+	unsigned value = (unsigned)me;
+	mcs_node n;
+	lock(mo.l, n);
+	{
+		size_t tsum = mo.sum;
+		mo.id = me;
+		yield(random(5));
+		if(mo.id != me) sout | "Intruder!";
+		mo.sum = tsum + value;
+	}
+	unlock(mo.l, n);
+	return value;
+}
+
+thread LockCheck {
+	size_t sum;
+};
+
+void main(LockCheck & this) {
+	this.sum = 0;
+	for(num_times) {
+		trash();
+		this.sum += cs();
+		trash();
+		yield(random(10));
+	}
+}
+
+int main() {
+	size_t sum = -32;
+	mo.sum = -32;
+	processor p[2];
+	sout | "Starting";
+	{
+		LockCheck checkers[13];
+		for(i;13) {
+			sum += join(checkers[i]).sum;
+		}
+	}
+	sout | "Done!";
+	if(sum == mo.sum) sout | "Match!";
+	else sout | "No Match!" | sum | "vs" | mo.sum;
+}
Index: tests/concurrent/unified_locking/mcs_block_spin_lock.cfa
===================================================================
--- tests/concurrent/unified_locking/mcs_block_spin_lock.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
+++ tests/concurrent/unified_locking/mcs_block_spin_lock.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
@@ -0,0 +1,8 @@
+#include <locks.hfa>
+
+#define LOCK mcs_block_spin_lock
+#include "mutex_test.hfa"
+
+int main() {
+    test();
+}
Index: tests/concurrent/unified_locking/mcs_spin.cfa
===================================================================
--- tests/concurrent/unified_locking/mcs_spin.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
+++ tests/concurrent/unified_locking/mcs_spin.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
@@ -0,0 +1,78 @@
+
+#include <fstream.hfa>
+#include <locks.hfa>
+#include <thread.hfa>
+
+const unsigned int num_times = 50;
+
+struct MutexObj {
+	mcs_spin_lock l;
+	thread$ * id;
+	uint32_t sum;
+	uint32_t cnt;
+};
+
+MutexObj mo;
+
+void trash() {
+	unsigned t[100];
+	for(i; 100) {
+		t[i] = 0xDEADBEEF;
+	}
+}
+
+uint32_t cs() {
+	thread$ * me = active_thread();
+	uint32_t value;
+    mcs_spin_node node;
+	lock(mo.l, node);
+	{
+		uint32_t tsum = mo.sum;
+		uint32_t cnt = mo.cnt;
+		mo.id = me;
+		yield(random(5));
+		value = ((uint32_t)random()) ^ ((uint32_t)me);
+		if(mo.id != me) sout | "Intruder!";
+		mo.cnt = cnt + 1;
+		mo.sum = tsum + value;
+	}
+	unlock(mo.l, node);
+	return value;
+}
+
+thread LockCheck {
+	uint32_t sum;
+};
+
+void main(LockCheck & this) {
+	this.sum = 0;
+	for(num_times) {
+		trash();
+		this.sum += cs();
+		trash();
+		yield(random(10));
+	}
+}
+
+void test() {
+	uint32_t sum = -32;
+	mo.sum = -32;
+	mo.cnt = 0;
+	processor p[2];
+	sout | "Starting";
+	{
+		LockCheck checkers[13];
+		for(i;13) {
+			sum += join(checkers[i]).sum;
+		}
+	}
+	sout | "Done!";
+	if(mo.cnt != (13 * num_times)) sout | "Invalid cs count!" | mo.cnt | "vs "| (13 * num_times) | "(13 *" | num_times | ')';
+	if(sum == mo.sum) sout | "Match!";
+	else sout | "No Match!" | sum | "vs" | mo.sum;
+}
+
+int main() {
+    test();
+	return 0;
+}
Index: tests/concurrent/unified_locking/mutex_test.hfa
===================================================================
--- tests/concurrent/unified_locking/mutex_test.hfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
+++ tests/concurrent/unified_locking/mutex_test.hfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
@@ -0,0 +1,79 @@
+
+#include <fstream.hfa>
+#include <locks.hfa>
+#include <thread.hfa>
+
+const unsigned int num_times = 50;
+
+struct MutexObj {
+	LOCK l;
+	thread$ * id;
+	uint32_t sum;
+	uint32_t cnt;
+};
+
+MutexObj mo;
+
+void trash() {
+	unsigned t[100];
+	for(i; 100) {
+		t[i] = 0xDEADBEEF;
+	}
+}
+
+uint32_t cs(uint32_t & entries) {
+	thread$ * me = active_thread();
+	uint32_t value;
+	lock(mo.l);
+	{
+		entries++;
+		uint32_t tsum = mo.sum;
+		uint32_t cnt = mo.cnt;
+		mo.id = me;
+		yield(random(5));
+		value = ((uint32_t)random()) ^ ((uint32_t)me);
+		if(mo.id != me) sout | "Intruder!";
+		mo.cnt = cnt + 1;
+		mo.sum = tsum + value;
+	}
+	unlock(mo.l);
+	return value;
+}
+
+thread LockCheck {
+	uint32_t sum;
+	uint32_t entries;
+};
+
+void main(LockCheck & this) {
+	this.sum = 0;
+	this.entries = 0;
+	for(num_times) {
+		trash();
+		this.sum += cs( this.entries );
+		trash();
+		yield(random(10));
+	}
+}
+
+void test() {
+	uint32_t sum = -32;
+	mo.sum = -32;
+	mo.cnt = 0;
+	uint32_t real_entries = 0;
+	processor p[2];
+	sout | "Starting";
+	{
+		LockCheck checkers[13];
+		for(i;13) {
+			LockCheck & curr = join(checkers[i]);
+			sum += curr.sum;
+			real_entries += curr.entries;
+		}
+	}
+	sout | "Done!";
+	if(real_entries != (13 * num_times)) sout | "Invalid real cs count!" | mo.cnt | "vs "| (13 * num_times) | "(13 *" | num_times | ')';
+	if(mo.cnt != (13 * num_times)) sout | "Invalid concurrent cs count!" | mo.cnt | "vs "| (13 * num_times) | "(13 *" | num_times | ')';
+	if(sum == mo.sum) sout | "Match!";
+	else sout | "No Match!" | sum | "vs" | mo.sum;
+}
Index: tests/concurrent/unified_locking/pthread_locks.cfa
===================================================================
--- tests/concurrent/unified_locking/pthread_locks.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
+++ tests/concurrent/unified_locking/pthread_locks.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
@@ -0,0 +1,108 @@
+#include <stdio.h>
+#include "locks.hfa"
+#include <stdlib.hfa>
+#include <thread.hfa>
+#include <time.h>
+#include <stdlib.hfa>
+
+const unsigned int num_times = 50;
+
+simple_owner_lock l;
+pthread_cond_var( simple_owner_lock ) c;
+
+owner_lock l2;
+condition_variable( owner_lock ) c2;
+
+volatile int counter = 0;
+
+thread Wait_Signal_1 {};
+
+void main( Wait_Signal_1 & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		lock(l);
+		if(empty(c) && i != num_times - 1) {
+			wait(c,l);
+		}else{
+			notify_one(c);
+		}
+		unlock(l);
+	}
+}
+
+thread Wait_3_Signal_3 {};
+
+void main( Wait_3_Signal_3 & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		lock(l);
+        counter++;
+		if(counter == 4 || i == num_times - 1) {
+            counter = 0;
+			notify_all(c);
+		}else{
+			wait(c,l);
+		}
+		unlock(l);
+	}
+}
+
+thread Rec_Lock_Wait_Signal_1 {};
+
+void main( Rec_Lock_Wait_Signal_1 & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		lock(l);
+		lock(l);
+		lock(l);
+		if(empty(c) && i != num_times - 1) {
+			wait(c,l);
+		}else{
+			notify_one(c);
+		}
+		unlock(l);
+		unlock(l);
+		unlock(l);
+	}
+}
+
+thread Wait_Time_Signal_1 {};
+
+void main( Wait_Time_Signal_1 & this ) {
+	for (unsigned int i = 0; i < num_times; i++) {
+		lock(l);
+		if(empty(c) || random(10) >= 9 ) {
+			timespec t;
+			clock_gettime(CLOCK_REALTIME, &t);
+			timespec waitTime{0,1};
+			bool woken = wait(c,l, t + waitTime);
+		}else{
+			notify_one(c);
+		}
+		unlock(l);
+	}
+}
+
+int main() {
+	processor p[1];
+	printf("Start Test 1: lock and condition variable single wait/notify\n");
+	{
+		Wait_Signal_1 t1[2];
+	}
+	printf("Done Test 1\n");
+
+	printf("Start Test 2: lock and condition variable 3 wait/notify all\n");
+	{
+		Wait_3_Signal_3 t1[4];
+	}
+	printf("Done Test 2\n");
+
+	printf("Start Test 3: lock and condition variable multiple acquire and wait/notify\n");
+	{
+		Rec_Lock_Wait_Signal_1 t1[2];
+	}
+	printf("Done Test 3\n");
+
+	printf("Start Test 4: lock and condition variable single timed wait/notify\n");
+	{
+		Wait_Time_Signal_1 t1[2];
+	}
+	printf("Done Test 4\n");
+}
Index: tests/concurrent/unified_locking/simple_owner_lock.cfa
===================================================================
--- tests/concurrent/unified_locking/simple_owner_lock.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
+++ tests/concurrent/unified_locking/simple_owner_lock.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
@@ -0,0 +1,8 @@
+#include <locks.hfa>
+
+#define LOCK simple_owner_lock
+#include "mutex_test.hfa"
+
+int main() {
+    test();
+}
Index: tests/concurrent/unified_locking/spin_queue_lock.cfa
===================================================================
--- tests/concurrent/unified_locking/spin_queue_lock.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
+++ tests/concurrent/unified_locking/spin_queue_lock.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
@@ -0,0 +1,8 @@
+#include <locks.hfa>
+
+#define LOCK spin_queue_lock
+#include "mutex_test.hfa"
+
+int main() {
+    test();
+}
Index: tests/concurrent/unified_locking/test_debug.cfa
===================================================================
--- tests/concurrent/unified_locking/test_debug.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
+++ tests/concurrent/unified_locking/test_debug.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
@@ -0,0 +1,31 @@
+#include "locks.hfa"
+
+fast_block_lock f;
+fast_block_lock f2;
+fast_cond_var( fast_block_lock ) f_c_f;
+
+thread T1 {};
+bool wait = true;
+bool wait2 = true;
+void main( T1 & this ) {
+    lock(f);
+    if (wait) {
+        wait = false;
+        wait(f_c_f, f);
+    } else {
+        notify_one(f_c_f);
+        unlock(f);
+    }
+    lock(f2);
+    if (wait2) {
+        wait2 = false;
+        wait(f_c_f, f2);
+    } else {
+        notify_one(f_c_f);
+        unlock(f2);
+    }
+}
+
+int main() {
+    T1 t[2];
+}
Index: tests/concurrent/unified_locking/thread_test.cfa
===================================================================
--- tests/concurrent/unified_locking/thread_test.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
+++ tests/concurrent/unified_locking/thread_test.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
@@ -0,0 +1,108 @@
+#include <stdio.h>
+#include "locks.hfa"
+#include <stdlib.hfa>
+#include <thread.hfa>
+#include <containers/array.hfa>
+
+static unsigned int taskCount = 4;
+static unsigned int threadCount = 2;
+static unsigned int lockCount = 1;
+static unsigned int total_times = 320000;
+static unsigned int num_times;
+static const int workBufferSize = 16;
+static unsigned int work_unlocked = 10000;
+static unsigned int work_locked = 10000;
+
+// taken from martin's thread_test
+static inline void dowork(volatile int* buffer, unsigned int steps) {
+  int value = 0;
+  for (unsigned int i = 0; i < steps; i += 1) {
+    // a little more work than just a single memory access helps with stability
+    value += (buffer[i % workBufferSize] * 17) / 23 + 55;
+  }
+  buffer[0] += value;
+}
+
+thread worker {
+    exp_backoff_then_block_lock * locks;
+    bool improved;
+};
+
+void ?{}( worker & w, exp_backoff_then_block_lock * locks, bool improved ) {
+	w.locks = locks;
+    w.improved = improved;
+}
+
+
+void main( worker & this ) with(this) {
+	int buffer[workBufferSize];
+    for (int i = 0; i < workBufferSize; i += 1) buffer[i] = rand() % 1024;
+    unsigned int lck = rand() % lockCount;
+    exp_backoff_then_block_lock * curr_lock = &locks[lck];
+    for (unsigned int i = 0; i < num_times; i++) {
+        dowork(buffer, work_unlocked);
+        if (improved) lock_improved(*curr_lock);
+        else lock(*curr_lock);
+        dowork(buffer, work_locked);
+        unlock(*curr_lock);
+        lck = rand() % lockCount;
+        curr_lock = &locks[lck];
+    }
+}
+
+int doOne = 0;
+int main(int argc, char* argv[]) {
+    switch (argc) {
+        case 8:
+            doOne = atoi(argv[7]);
+        case 7:
+            work_unlocked = atoi(argv[6]);
+        case 6:
+            work_locked = atoi(argv[5]);
+        case 5:
+            total_times = atoi(argv[4]);
+        case 4:
+            lockCount = atoi(argv[3]);
+        case 3:
+            threadCount = atoi(argv[2]);
+        case 2:
+            taskCount = atoi(argv[1]);
+        case 1:
+            break;
+        default:
+            break;
+    }
+	processor p[threadCount];
+    exp_backoff_then_block_lock locks[lockCount];
+    worker * worker_arr[taskCount];
+    num_times = total_times  / taskCount;
+    //printf("%d\n", doOne);
+	//
+	//clock_t begin = clock();
+    if (doOne == 1) {
+        printf("Start Test: martin lock simple %d\n", num_times);
+	for (unsigned int i = 0; i < taskCount; i++) {
+        worker_arr[i] = new( locks, false );
+    }
+    for (unsigned int i = 0; i < taskCount; i++) {
+        delete( worker_arr[i] );
+    }
+    }
+	//clock_t end = clock();
+	//double time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
+	//printf("norm: %f\n", time_spent);
+
+    //printf("Start Test: martin lock improved\n");
+	//begin = clock();
+    if (doOne == 2) {
+	for (unsigned int i = 0; i < taskCount; i++) {
+        worker_arr[i] = new( locks, true );
+    }
+    for (unsigned int i = 0; i < taskCount; i++) {
+        delete( worker_arr[i] );
+    }
+    }
+	//end = clock();
+	//time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
+	//printf("improved: %f\n", time_spent);
+}
Index: tests/concurrent/unified_locking/timeout_lock.cfa
===================================================================
--- tests/concurrent/unified_locking/timeout_lock.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
+++ tests/concurrent/unified_locking/timeout_lock.cfa	(revision 357ab79287a120087270faf546ed2e37eb177d6d)
@@ -0,0 +1,87 @@
+#include <stdio.h>
+#include <locks.hfa>
+#include <alarm.hfa>
+#include <stdlib.hfa>
+#include <thread.hfa>
+#include <kernel.hfa>
+
+multiple_acquisition_lock m, n;
+condition_variable( multiple_acquisition_lock ) c_m, c_n;
+
+const unsigned int NoOfTimes = 20;
+
+void block() { // used for barrier like behaviour
+	lock(n);
+	if (empty( c_n )) {
+		wait( c_n, n );
+	} else {
+		notify_one( c_n );
+	}
+	unlock(n);
+}
+
+thread T1 {};
+
+void main( T1 & this ) {
+	lock(m);
+	wait( c_m, m, 1`s );
+	// printf("Thread: %p timedout\n", active_thread()); // removed since can't expect non deterministic output
+
+	block();
+
+	// Test calls which occur increasingly close to timeout value.
+
+	for ( unsigned int i = 0; i < NoOfTimes + 3; i += 1 ) {
+	    if ( wait( c_m, m, 1000000`ns ) ) {
+			// printf("Thread: %p signalled\n", active_thread()); // removed since can't expect non deterministic output
+	    } else {
+			// printf("Thread: %p timedout\n", active_thread()); // removed since can't expect non deterministic output
+	    } // if
+
+	    block();
+	} // for
+}
+
+
+thread T2 {};
+
+void main( T2 & this ) {
+	block();
+
+	// Test calls which occur increasingly close to timeout value.
+
+	sleep( 100000`ns );
+	notify_one(c_m);
+	block();
+
+	sleep( 500000`ns );
+	notify_one(c_m);
+	block();
+
+	sleep( 900000`ns );
+	notify_one(c_m);
+	block();
+
+	for ( unsigned int i = 0; i < NoOfTimes; i += 1 ) {
+	    sleep( 999700`ns );
+		notify_one(c_m);
+	    block();
+	} // for
+}
+
+int main() {
+	processor p[2];
+	printf("Start Test 1: surface testing condition variable timeout routines\n");
+	wait( c_m, 1`ns );														// bool wait( condition_variable(L) & this, Duration duration );
+	wait( c_m, 10, 1`ns );													// bool wait( condition_variable(L) & this, uintptr_t info, Duration duration );
+	lock(m); wait( c_m, m, 1`ns ); unlock(m); 								// bool wait( condition_variable(L) & this, L & l, Duration duration );
+	lock(m); wait( c_m, m, 10, 1`ns ); unlock(m);							// bool wait( condition_variable(L) & this, L & l, uintptr_t info, Duration duration );
+	printf("Done Test 1\n");
+
+	printf("Start Test 2: testing timeout vs signalling with varying timeout durations\n");
+	{
+		T1 t1;
+		T2 t2;
+	}
+	printf("Done Test 2\n");
+}
