Makefile: Makefile removed, qt project config modified to cover all needed sources...
[mines3d.git] / threads / thread_controller.cpp
blob7d3489adec48cc1a1b71b41b8846f03c1f484404
1 #include "thread_controller.h"
2 #include "../opengl/runGlutMainLoop.h"
4 Thread_controller::Thread_controller()
7 selected = new int[6];
8 dim = new int[3];
9 id = 0;
10 ptf = 0;
11 b = 0;
12 pthread_mutex_init(&mutex, 0);
16 Thread_controller::~Thread_controller()
18 delete[] selected;
19 delete[] dim;
20 selected = 0;
21 dim = 0;
24 void Thread_controller::run_thread(void)
26 if (id == 0)
28 pthread_create(&pthread1,0,runGlutMainLoop,(void *)this);
29 id = 1;
34 void Thread_controller::update_data(int x,int y,int z,Board * brd)
36 pthread_mutex_lock(&mutex);
37 b = brd;
38 dim[0] = x;
39 dim[1] = y;
40 dim[2] = z;
41 selected[0] = selected[1] = selected[2] = -1;
42 selected[3] = selected[4] = selected[5] = -1;
43 pthread_mutex_unlock(&mutex);
46 void Thread_controller::mutex_lock(void)
48 pthread_mutex_lock(&mutex);
51 void Thread_controller::mutex_unlock(void)
53 pthread_mutex_unlock(&mutex);