Knowing if a GThread is still alive



Hi!

g_thread_foreach() has been deprecated since Glib 2.32, and I wonder how I can replace it: I used it to know if a GThread pointer corresponded to a still "alive" thread.

So I'm looking for some advice on how to check if a GThread (say A) is still alive while my code executes in another thread (say B). I've thought about two ways to do this but could find none which seems to work:
1) lock a GMutex at some point when code is executed by A, and in B try to lock the mutex. I don't think it can work because when A exits, the mutex remains locked
2) configure thread A to execute a "cleanup" function when it exits (like atexit), but I don't think it's doeable

Many thanks for any advice here!

Regards,

Vivien


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