tizen 2.4 release
[framework/graphics/coregl.git] / src / coregl_thread_pthread_and_gcc_tlv.c
1 #include "coregl_internal.h"
2
3 //////////////////////////////////////////////////////////////////////////
4 // Need implement this
5 int mutex_init(Mutex *mt);
6 int mutex_lock(Mutex *mt);
7 int mutex_unlock(Mutex *mt);
8 int get_current_thread();
9 int set_current_thread_state(GLThreadState *tstate);
10 GLThreadState * get_current_thread_state();
11 //////////////////////////////////////////////////////////////////////////
12
13 static __thread GLThreadState *per_thread_state = NULL;
14
15 int
16 mutex_init(Mutex *mt)
17 {
18         int ret = 0;
19
20         if (pthread_mutex_init(mt, NULL) == 0)
21                 ret = 1;
22         else
23                 ret = 0;
24
25         return ret;
26 }
27
28
29 int
30 mutex_lock(Mutex *mt)
31 {
32         int ret = 0;
33
34         if (pthread_mutex_lock(mt) == 0)
35                 ret = 1;
36         else
37                 ret = 0;
38
39         return ret;
40 }
41
42 int
43 mutex_unlock(Mutex *mt)
44 {
45         int ret = 0;
46
47         if (pthread_mutex_unlock(mt) == 0)
48                 ret = 1;
49         else
50                 ret = 0;
51
52         return ret;
53 }
54
55 int
56 get_current_thread()
57 {
58         return pthread_self();
59 }
60
61 int
62 set_current_thread_state(GLThreadState *tstate)
63 {
64         per_thread_state = tstate;
65         return 1;
66 }
67
68 GLThreadState *
69 get_current_thread_state()
70 {
71         return per_thread_state;
72 }
73
74