 
 		is_monitoring = false;
 		done = false;
-		has_task = false,
+		has_task = false;
 		//pthread_mutex_init(&mutex_has_task, NULL);
 
 		reset();

	// initialize cuPrintf
	cudaPrintfInit();

	device_method<<<1, 1>>>(d_kernelWrapper);

	// display the device's output
	cudaPrintfDisplay();

__global__ void device_method(KernelWrapper *d_kernelWrapper) {

	int thread_id = threadIdx.x + blockIdx.x * blockDim.x;
	int count = 0;

	while (count < 100) {
		// (old == -1 ? thread_id : old)
		int old = atomicCAS((int *) &d_kernelWrapper->lock_thread_id, -1,
				thread_id);

		cuPrintf("Thread %d old: %d\n", thread_id, old);

		if (old == -1 || old == thread_id) {
			//do critical section code
