This is the mail archive of the pthreads-win32@sources.redhat.com mailing list for the pthreas-win32 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Cancellation points


Simon Gerblich wrote:
[...]
> Is it correct if I put pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 
NULL)
 ^^^^

> after the small piece of code where I don't want a cancelation point? 

It's correct as long as you use it properly; with proper arguments. 
AFAICS, the use of null pointer for "oldstate"/"oldtype" is incorrect.

http://www.opengroup.org/onlinepubs/007904975/functions/pthread_setcancelstate.html

regards,
alexander.

Sent by:        pthreads-win32-owner@sources.redhat.com
To:     pthreads-win32@sources.redhat.com
cc:      
Subject:        RE: Cancellation points


>BTW,
>
>> pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL)
>                                                 ^^^^
>
>that's incorrect. Don't do this.
>
>regards,
>alexander.

alexander,

Is it correct if I put pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL)
after the small piece of code where I don't want a cancelation point?  I 
am
aware that if I start using pthread_setcancelstate() in my code I should
take care to use the "oldstate" as described in the RATIONALE and restore
the state correctly.

I was only using pthread_setcancelstate to confirm if there was a problem
with the pthread_mutex_lock() function in the 2002-11-04 snapshot. 

Thanks,
Simon



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]