• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to suspend and resume (almost) all threads of a process ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Eric Albert <email@hidden>
  • Date: Thu, 20 Jan 2005 15:13:08 -0800

On Jan 20, 2005, at 2:58 PM, Nat! wrote:

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.

When I worked for Microsoft we needed to do something similar as part of the shared source CLI. You can download the source code at <http://msdn.microsoft.com/net/sscli/> if you want, but the quick summary is that you can use the Mach thread_suspend and thread_resume functions to do this. To get a Mach thread ID from a pthread, call pthread_mach_thread_np.


Technically this isn't supported (as is true for most of the Mach functions), but it's worked fine on every Mac OS X release I've used and I imagine it's likely to continue to work.

-Eric

_______________________________________________
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


References: 
 >How to suspend and resume (almost) all threads of a process ? (From: Nat! <email@hidden>)
 >Re: How to suspend and resume (almost) all threads of a process ? (From: Nat! <email@hidden>)

  • Prev by Date: Re: How to suspend and resume (almost) all threads of a process ?
  • Next by Date: Re: How to suspend and resume (almost) all threads of a process ?
  • Previous by thread: Re: How to suspend and resume (almost) all threads of a process ?
  • Next by thread: Re: How to suspend and resume (almost) all threads of a process ?
  • Index(es):
    • Date
    • Thread