equal
deleted
inserted
replaced
102 |
102 |
103 void *ret; |
103 void *ret; |
104 pthread_join(m_thr, &ret); |
104 pthread_join(m_thr, &ret); |
105 m_thr = 0; |
105 m_thr = 0; |
106 |
106 |
107 delete this; |
|
108 |
|
109 return ret; |
107 return ret; |
110 } |
108 } |
111 |
109 |
112 /* virtual */ bool IsCurrent() |
110 /* virtual */ bool IsCurrent() |
113 { |
111 { |
135 */ |
133 */ |
136 void *ThreadProc() |
134 void *ThreadProc() |
137 { |
135 { |
138 /* The new thread stops here so the calling thread can complete pthread_create() call */ |
136 /* The new thread stops here so the calling thread can complete pthread_create() call */ |
139 sem_wait(&m_sem_start); |
137 sem_wait(&m_sem_start); |
140 |
|
141 /* Did this thread die naturally/via exit, or did it join? */ |
|
142 bool exit = false; |
|
143 |
138 |
144 /* Call the proc of the creator to continue this thread */ |
139 /* Call the proc of the creator to continue this thread */ |
145 try { |
140 try { |
146 m_proc(m_param); |
141 m_proc(m_param); |
147 } catch (...) { |
142 } catch (...) { |
148 exit = true; |
|
149 } |
143 } |
150 |
144 |
151 /* Notify threads waiting for our completion */ |
145 /* Notify threads waiting for our completion */ |
152 sem_post(&m_sem_stop); |
146 sem_post(&m_sem_stop); |
153 |
|
154 if (exit) delete this; |
|
155 |
147 |
156 pthread_exit(NULL); |
148 pthread_exit(NULL); |
157 } |
149 } |
158 }; |
150 }; |
159 |
151 |