bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Diferent behaviour for Thread between Linux and Windows.


From: David Sugar
Subject: Re: Diferent behaviour for Thread between Linux and Windows.
Date: Mon, 14 Jun 2004 17:58:29 -0400
User-agent: KMail/1.6.2

There are a couple of places that posix and w32 thread behavior deviates.  The 
most striking is the use of execution suspend/resume in w32.  This behavior 
is found nowhere in pthread.  Some implementations have it through a custom 
extension.  Sun, which has it's own threading api, also has this.  However, a 
pure pthread system has no means to suspend/resume thread execution.  The 
best we can do to simulate this behavior is use a signal handler and sigwait, 
although there may be other less desirable side effects of this.  

On the other hand, cancellation points, a core feature of pthread, and useful 
for graceful termination, similarly does not exist in w32 threads, although 
it is relatively easy to simulate the behavior itself.  However, simulating 
cancellation points for all relevant system calls and file access is much 
harder, and hence, we only have cancellation points in w32 where relevant to 
other Common C++ operations and classes that will also block.  Of course, 
some target posix platforms (macosx comes to mind) are also extremely 
deficient in their use of cancellation points.

In the particular case of restarting threads, should they be restartable?  
This seems like something that can be made to behave the same on all 
platforms since I think it's just in the common c++ implementation that does 
this, and hence should only be necessary to fix for one to behave the same as 
the other, whichever is deemed the correct or most useful behavior.

On Monday 14 June 2004 05:15 pm, Marcelo Dalmas wrote:
> Hi all,
>
> There are diferent behaviour for Thread between Linux and Windows. (see
> example.cpp).
>
> For Windows it's no possible start a thread twice.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]