Re: Kill gthreads



On Tue, 08 Oct 2002 11:08:45 -0400
Tristan Van Berkom wrote:

   >    if ((thread_id = fork()) == 0) {

        Forking is not exactly threads. In fact, it isn't. Fork will create a
new process...

        However, if g_threads is implemented on top of pthreads (which I think
it is), there should be a function that does that. With pthreads, the
idea is that while the thread that is doing the lookup might be blocked,
the other one(s) are not and can kill the blocked thread.
        In pthreads, one has pthread_kill (tid), or pthread_cancel (tid) which
will do exactly what you want.
        Of course, you could you non-blocking io...

        HTH,

                -- Mitko

P.S. I took a look at the GLib reference and the thread api is rather
poor. You might be better off just using pthreads because they provide
much more control...

-- 
========================================================================
     __  __  __________________ _________
    /  |/  |/  /__/__   ___/  |/  /     /      Dimitar Haralanov
   /          /  /  /  /  /      /  /  /       Software Engineer
  /   /   /  /  /  /  /  /  /\  \  /  /        Tahoe Networks
 /___/___/__/__/  /__/  /__/  |__|___/         mitko tahoenetworks com

========================================================================
  GPG Fingerprint:  21C1 8244 93F3 F2E9 013C  0C12 70DC C58E 6337 ABD1
-----------------------------------------------------------------------
-History repeats itself only if one does not listen the first time.



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