Changeset 1476:fdb1826f79da
- Timestamp:
- 08/28/10 14:26:05 (18 months ago)
- Branch:
- default
- Location:
- sources
- Files:
-
- 2 edited
-
examples/pc_thread/test.cc (modified) (2 diffs)
-
src/pcExecutionThread.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sources/examples/pc_thread/test.cc
r1464 r1476 34 34 } 35 35 36 // throwing *eception36 // throwing exception 37 37 tools::os::os::setWorkingDir("./dir/"); 38 38 … … 48 48 49 49 ::data.set((void *)data); 50 51 execution::thread(thread, (void *)"detached", execution::ON_DESTRUCTION_KEEP_ALIVE, true).run(); 50 52 51 53 execution::manager manager; -
sources/src/pcExecutionThread.cc
r1471 r1476 130 130 } 131 131 132 if (ti->detached) { 133 #ifdef DL_EXT 134 if (ti->handle != NULL) { 135 thread::deinitModule deinit = (thread::deinitModule)dlsym(ti->handle, "deinitPcExecutionThreadModule"); 136 if (deinit != NULL) 137 deinit(ti->cookie); 138 139 #ifndef DL_FAST 140 dlclose(ti->handle); 141 #endif 142 } 143 #endif 144 145 delete ti->ex; 146 delete ti; 147 } 148 132 149 return NULL; 133 150 } … … 155 172 handle->func = (void *)func; 156 173 handle->action = action; 157 #ifdef DL_EXT158 handle->handle = NULL;159 #endif160 174 161 175 #ifdef PTHREAD_EXT … … 244 258 { 245 259 if (!cloned) { 246 #ifdef DL_EXT247 deinitModule deinit;248 #endif249 250 260 #ifdef PTHREAD_EXT 251 261 pthread_attr_destroy(&handle->attr); 252 262 #endif 253 263 254 if (!isRunning() || handle->detached) 255 return; 256 257 switch (handle->action) { 258 case ON_DESTRUCTION_KEEP_ALIVE: 259 260 #ifdef PTHREAD_EXT 261 pthread_detach(handle->thread); 262 #endif 263 264 break; 265 266 case ON_DESTRUCTION_STOP: 267 268 #ifdef PTHREAD_EXT 269 pthread_cancel(handle->thread); 270 #endif 271 272 break; 273 274 case ON_DESTRUCTION_WAIT: 275 default: 276 277 #ifdef PTHREAD_EXT 278 pthread_join(handle->thread, NULL); 279 #endif 280 281 break; 264 if (isRunning()) { 265 if (handle->detached) 266 return; 267 268 switch (handle->action) { 269 case ON_DESTRUCTION_KEEP_ALIVE: 270 handle->detached = true; 271 #ifdef PTHREAD_EXT 272 pthread_detach(handle->thread); 273 #endif 274 return; 275 276 case ON_DESTRUCTION_STOP: 277 #ifdef PTHREAD_EXT 278 pthread_cancel(handle->thread); 279 #endif 280 break; 281 } 282 282 } 283 283 284 #ifdef PTHREAD_EXT 285 if (!handle->joined) 286 pthread_join(handle->thread, NULL); 287 #endif 288 284 289 #ifdef DL_EXT 285 290 if (handle->handle != NULL) { 286 deinit = (deinitModule)dlsym(handle->handle, "deinitPcExecutionThreadModule");291 deinitModule deinit = (deinitModule)dlsym(handle->handle, "deinitPcExecutionThreadModule"); 287 292 if (deinit != NULL) 288 293 deinit(handle->cookie); … … 293 298 } 294 299 #endif 295 } 296 297 delete handle->ex; 298 299 delete handle; 300 301 delete handle->ex; 302 delete handle; 303 } 300 304 } 301 305
Note: See TracChangeset
for help on using the changeset viewer.
