 	// initialize cuPrintf
 	cudaPrintfInit();
 
-	device_method<<<4, 1>>>(d_kernelWrapper);
+	//device_method<<<4, 1>>>(d_kernelWrapper);
 
 	// display the device's output
 	cudaPrintfDisplay();
 	// clean up after cuPrintf
 	cudaPrintfEnd();
 
-	h_kernelWrapper->active_thread_id = 0;
+	h_kernelWrapper->lock_thread_id = 0;
 	h_kernelWrapper->sendDone();
 
 	// wait for SocketServer

public:
	volatile MESSAGE_TYPE command;
	volatile bool has_task;
	volatile int active_thread_id;
	volatile bool done;

	KernelWrapper() {
		init();

		}
		case DONE: {
			socket_client.sendCMD(DONE);
			result_available = true;
			break;
		}

		}
	}

	__device__ __host__ void reset() {
		lock_thread_id = -1;
		command = UNDEFINED;
		has_task = false;
		task_accepted = false;
		result_available = false;
	}

	__device__ __host__ int getValue(int val) {

		// wait for wrapper thread to end
		while (has_task) {
		}

		command = GET_VALUE;
		param1 = val;
		has_task = true;
		//__threadfence_system();

		// wait for wrapper thread to accept
		while (!task_accepted) {
		}

		// wait for socket communication to end
		while (!result_available) {
		}

		reset();
		return result_int;
	}

	__device__ __host__ void sendDone() {
		command = DONE;
		has_task = true;

		// wait for wrapper thread to accept
		while (!task_accepted) {
		}

		printf(
				"KernelWrapper::sendDone: has_task: %s, task_accepted: %s, lock_thread_id: %d, command: %d\n",
				(has_task) ? "true" : "false",
				(task_accepted) ? "true" : "false", lock_thread_id, command);

		// wait for socket communication to end
		while (!result_available) {
		}

		reset();
		done = true;
		return;
	}
};

