Denis Oliver Kropp wrote:
> Attilio Fiandrotti schrieb:
>> Denis Oliver Kropp wrote:
>>> Attilio Fiandrotti schrieb:
>>>
>>>> Denis Oliver Kropp wrote:
>>>>
>>>>> Should be possible with minor effort. pthread_cancel() is evil anyways.
>>>>>
>>>> Dok, we would really really apreciate if you could provide us ASAP 
>>>> the patch: we're now kind of running out of time as Etch release date 
>>>> gets closer every day.
>>>> I'll build an experimental ISO image with your patch and ask people 
>>>> to test it to catch possible issues coming from the patch.
>>>
>>> Working on it now.
>>>
>> :)
> 
> 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.

Apart from that, where exactly are you having that problem with the
read() call (i.e. which driver,module,...)?

I ask beceuse I have removed pthread_cancel() calls in my code and
I am not experiencing problems with read() calls.
The only remaining thing to do is to replace the pthread_cond_wait()
call in the vt switcher thread with a loop of
pthread_cond_timedwait()/direct_thread_testcancel().

-- 
Regards,
     Claudio Ciccani

[EMAIL PROTECTED]
http://directfb.org
http://sf.net/projects/php-directfb
--- DirectFB/lib/direct/thread.c	2006-10-29 13:53:56.000000000 +0100
+++ /home/klan/src/DirectFB/lib/direct/thread.c	2006-11-30 12:15:03.000000000 +0100
@@ -300,8 +300,6 @@
      D_DEBUG_AT( Direct_Thread, "Canceling %d.\n", thread->tid );
 
      thread->canceled = true;
-
-     pthread_cancel( thread->thread );
 }
 
 bool
@@ -321,7 +319,7 @@
 
      /* Quick check before calling the pthread function. */
      if (thread->canceled)
-          pthread_testcancel();
+          pthread_exit( PTHREAD_CANCELED );
 }
 
 void
@@ -372,11 +370,11 @@
                            thread->name, thread->tid );
 
                if (thread->name)
-                    D_ERROR( "Direct/Thread: Canceling '%s' (%d)!\n", thread->name, thread->tid );
+                    D_ERROR( "Direct/Thread: Killing '%s' (%d)!\n", thread->name, thread->tid );
                else
-                    D_ERROR( "Direct/Thread: Canceling %d!\n", thread->tid );
+                    D_ERROR( "Direct/Thread: Killing %d!\n", thread->tid );
 
-               pthread_cancel( thread->thread );
+               pthread_kill( thread->thread, SIGKILL );
           }
      }
 
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to