Fixed initialisation of tf in file_open(). Without setting the memory to 0,
[cinelerra_cv/mob.git] / guicast / thread.h
blob0d244e6b4d410b4ace2972a6702597fb88948718
1 #ifndef THREAD_H
2 #define THREAD_H
4 #include <pthread.h>
6 // The thread does not autodelete by default.
7 // If autodelete is 1 the thread autodeletes.
8 // If it's synchronous the deletion occurs in join().
9 // If it's asynchronous the deletion occurs in entrypoint.
12 class Thread
14 private:
15 static void* entrypoint(void *parameters);
16 protected:
17 virtual void run() = 0;
18 public:
19 Thread(int synchronous = 0, int realtime = 0, int autodelete = 0);
20 virtual ~Thread();
21 void start();
22 int end(pthread_t tid); // end another thread
23 int end(); // end this thread
24 int cancel(); // end this thread
25 int join(); // join this thread
26 int suspend_thread(); // suspend this thread
27 int continue_thread(); // continue this thread
28 int exit_thread(); // exit this thread
29 int enable_cancel();
30 int disable_cancel();
31 int get_cancel_enabled();
32 int running(); // Return if thread is running
33 int set_synchronous(int value);
34 int set_realtime(int value = 1);
35 int set_autodelete(int value);
36 int get_autodelete();
37 // Return realtime variable
38 int get_realtime();
39 // Return 1 if querying the kernel returned a realtime policy
40 static int calculate_realtime();
41 int get_synchronous();
42 int get_tid();
44 private:
45 int synchronous; // set to 1 to force join() to end
46 int realtime; // set to 1 to schedule realtime
47 int autodelete; // set to 1 to autodelete when run() finishes
48 int thread_running;
49 pthread_t tid;
50 int tid_valid;
51 int cancel_enabled;
54 #endif