Re: pthread_t through pthread_self?



On Sun, 13 Aug 2006, Luka Napotnik wrote:

I'm interested if the function pthread_self() returns a valid pthread_t
structure for threads, created with g_thread_new() so the pthread_t can
be used with pthread_kill() ?

As long as you are working on top of POSIX, yes, it should.

pthread_kill() does perhaps do not do what you want:

http://docs.sun.com/app/docs/doc/816-5137/6mba5vpk4?a=view

http://users.du.se/~hjo/realtime/manuals/posix-threads/uguide/users-95.htm
  "For example, sending a SIGKILL signal to a thread using pthread_kill()
  will terminate the entire process, not simply the target thread. SIGKILL
  is defined to terminate the entire process, regardless of the thread it
  is delivered to, or how it is sent."

You probably want to use pthread_cancel().

http://www2.yo-linux.com/cgi-bin/man.cgi?section=all&topic=pthread_cancel

-Peter



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