
29 Jan
2010
29 Jan
'10
11:37 p.m.
Hua Su
Is it OK to use both pthread and boost.thread in the same program under linux?
Yes.
1. use pthread api to create/join/detach/cancel threads but use boost.thread's mutex/condition_variable etc. to do thread synchronization, and this_thread/ sleep/get_id/thread_local_storage etc..
That's fine.
2. use boost.thread api to create/join/detach/interrupt thread but use pthread api to do thread synchronization.
And that's fine too. Anthony -- Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/ just::thread C++0x thread library http://www.stdthread.co.uk Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976