Re: How to suspend and resume (almost) all threads of a process ?
Re: How to suspend and resume (almost) all threads of a process ?
- Subject: Re: How to suspend and resume (almost) all threads of a process ?
- From: Nat! <email@hidden>
- Date: Thu, 20 Jan 2005 23:58:57 +0100
Am 19.01.2005 um 19:42 schrieb Nat!:
I'd like to do the following. In my library code I want to get a list
of all threads of my process and the thread I am currently in myself
(pthread_this()). What I then want to do is suspend all the other
threads, do a little processing and then resume all the other threads.
The general idea is something akin to a "full garbage collection".
The effect would be a process-wide mutex without the mutex.
Well the replies I got privately say, that you can't do that in Darwin.
You can probably get the lists of threads, but the suspension of a
related thread in the same process is not supported. That wraps up this
mail thread.
As I have just a little time on my hand, I'd like to add the following
musings for posterity :)
There appear to be some pthread extensions (sorry I lost the links),
which go in the direction I need, but they wouldn't work either, since
you can't truely nest the suspension calls.
To get my scenario to work, it would have to be necessary to be able to
suspend and resume a thread multiple times (using a counter). I would
have to suspend a thread, that already might be suspended, because I
can't be sure, this thread wouldn't unsuspend itself - maybe acquiring
a kernel resource -, while I want to do work behind its back.
Obviously real-time threads would be cranky, if I suspended them, but
that's OK, for in my code, I don't have to worry about and deal with
thread priorities.
Ciao
Nat!
------------------------------------------------------
As an ex-Atari employee, who has known both
high income and protracted unemployment,
I can assure you that nobody should enter programming
for the money. - Chris Crawford
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden