Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 06 Nov 2005 12:07:29 +0800
From:      Erich Dollansky <oceanare@pacific.net.sg>
To:        Nicolas Blais <nb_root@videotron.ca>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: c++ with pthread?
Message-ID:  <436D8181.9090909@pacific.net.sg>
In-Reply-To: <200511051927.40752.nb_root@videotron.ca>
References:  <200511051927.40752.nb_root@videotron.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

Nicolas Blais wrote:
> 
> It compiles and works fine. I'm trying to make the same program in C++.  Is 
> the syntax for pthreading the same as in C? I was wondering if someone can 
> point me in the right direction.
> 
the threading stuff stays the same.

> Also, is there anything I should be worried about when using pthread and C++? 
> (Some years ago, I heard that FreeBSD's pthread didn't like C++... could be a 
> false rumour)

You cannot use classes directly with threading functions. Your classes 
must be aware of threading. You need some mechanism to protect classes 
which are not threadsafe if more than one thread could access an object 
at te same moment of time.

This is a general problem of threading which might causes problems.

Do not forget that C++ uses additional data in objects which the 
programmer does not see.

Erich



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?436D8181.9090909>