Changeset 35:f8a5b321d0c3 in xplcommon for src/xplcommon/posix/Thread.cc
- Timestamp:
- 01/03/13 06:57:15 (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/xplcommon/posix/Thread.cc
r3 r35 40 40 void* Thread::threadFn(void* arg) 41 41 { 42 reinterpret_cast<Thread*>(arg)->run(); 42 Thread* thread = reinterpret_cast<Thread*>(arg); 43 thread->run(); 44 if (thread->detached) delete thread; 43 45 return 0; 46 } 47 48 //------------------------------------------------------------------------------ 49 50 bool Thread::start() 51 { 52 pthread_attr_t attr; 53 pthread_attr_init(&attr); 54 pthread_attr_setdetachstate(&attr, detached ? PTHREAD_CREATE_DETACHED : 55 PTHREAD_CREATE_JOINABLE); 56 bool isOK = pthread_create(&thread, &attr, &threadFn, this)>=0; 57 pthread_attr_destroy(&attr); 58 return isOK; 44 59 } 45 60
Note:
See TracChangeset
for help on using the changeset viewer.