Denis Oliver Kropp wrote:
> Claudio Ciccani schrieb:
>> Denis Oliver Kropp wrote:
>>> Still looking for a way to interrupt a blocking read()
>>> from outside (other thread) without using a signal.
>>>
>>> Simply closing it wasn't helpful.
>>>
>>> I also couldn't find anything if we'd be using select() or poll().
>>>
>>> pthread_cancel() interrupts the read, but it also interrupts
>>> too many other places... and is the one to be removed anyways.
>>>
>>> Any idea apart from using a pipe with select() on the pipe and device?
>>>
>>
>> This is why pthread_cancel() exists.
> 
> But pthread_cancel() also terminates the thread at mutex_lock for
> example which would be bad if a lock is already taken. I'd prefer
> having well chosen voluntary exit points.
> 

That can be avoided by using a similar procedure:

pthread_setcancelstate(PTHREAD_CANEL_DISABLE)
//
// safe calls ...
//
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE)
// process pending cancelations
pthread_testcancel()


According to me, the problems you are encountering suggest that
pthread_cancel() should not be removed.


-- 
Regards,
     Claudio Ciccani

[EMAIL PROTECTED]
http://directfb.org
http://sf.net/projects/php-directfb

_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to