Boost logo

Boost Users :

Subject: Re: [Boost-users] mix usage of boost.thread and pthread?
From: Hua Su (huas.su_at_[hidden])
Date: 2010-01-30 01:14:46


On Sat, Jan 30, 2010 at 6:46 AM, OvermindDL1 <overminddl1_at_[hidden]> wrote:

> On Fri, Jan 29, 2010 at 11:26 AM, Hua Su <huas.su_at_[hidden]> wrote:
> > Hi all,
> > Is it OK to use both pthread and boost.thread in the same program under
> > linux? E.g., there are two cases:
> > 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..
> > 2. use boost.thread api to create/join/detach/interrupt thread but use
> > pthread api to do thread synchronization.
> > I know boost.thread is a pthread api wrapper under linux, but I'm afraid
> of
> > that the two cases above aren't safe if boost.thread uses some tricks I
> > don't understand.
> > Would you kindly give any hints?
>
> I do not program much using pthreads, so I cannot say about it for
> sure, but about other threading back-ends I know that you can use them
> both in the same program, but they do not mix as Boost.Threads
> registers things and so forth (else things like this_thread will not
> work on non Boost.Threads).
>
> Why would you want to mix them anyway?
>

My program is built with a third-party framework that uses some pthread
things, but I want to use boost.thread to implement my own part.

> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net