#include <stdio.h>
#include <assert.h>
#include <pthread.h>
#include "LockFreeQueue.h"

/*
22    [TestMethod]
23    [HostType("Chess")]
24    [TestProperty("ChessMonitorVolatiles","True")]
25    [TestProperty("ChessBound","4")]
26    public void TestLockFreeQueueWithError2(){
27      QueueTest qt = new QueueTest();
28      LockFreeQueue lfq = 
29          new LockFreeQueueWithError2();
30      EnqContainer firstParams, secondParams;
31      firstParams.q = secondParams.q = lfq;
32      firstParams.first = "a";
33      firstParams.second = "b";
34      secondParams.first = "c";
35      secondParams.second = "d";
36      Thread t2 = new Thread(
37                    new ParameterizedThreadStart(
38                                qt.EnqTwoStrings));
39      Thread t3 = new Thread(
40                    new ParameterizedThreadStart(
41                            qt.DeqThreeStrings));
42      t2.start(secondParams);
43      t3.start(lfq);
44      QueueTwoItems(firstParams);
45      t2.join();
46      t3.join();
47    }
48  }
*/
void TestLockFreeQueueWithError2 () {
	pthread_t t1, t2, t3;
	LockFreeQueue *lfq = NewLockFreeQueue();
	
	EnqContainer firstParams, secondParams;
	firstParams.queue = secondParams.queue = lfq;
	firstParams.first = "a";
	firstParams.second = "b";
	secondParams.first = "c";
	secondParams.second = "d";
	
	pthread_create(&t1, NULL, EnqTwoStrings_WithError2, &firstParams);
	pthread_create(&t2, NULL, EnqTwoStrings_WithError2, &secondParams);
	pthread_create(&t3, NULL, DeqThreeStrings, lfq);
	pthread_join(t1, NULL);
	pthread_join(t2, NULL);
	pthread_join(t3, NULL);
}


int main (void) {
	TestLockFreeQueueWithError2();
	return 0;
}


