Re: Suspending a task
Re: Suspending a task
- Subject: Re: Suspending a task
- From: Ken Thomases <email@hidden>
- Date: Wed, 17 Oct 2012 07:28:40 -0500
On Oct 17, 2012, at 1:19 AM, Programmingkid wrote:
> How do I programmatically suspend a task? I looked at a function called task_suspend(), but I don't know how to make it work. Anyone have any example code that shows how to use this function?
This doesn't appear to have anything to do with Xcode, so it shouldn't be on the Xcode-Users list.
Also, the term "task" is ambiguous. Do you mean a process? A thread? A work item submitted using Grand Central Dispatch? An NSOperation submitted to an NSOperationQueue?
What language are you programming in and against which frameworks or libraries? If you're programming in Cocoa and talking about a process, you can use NSTask to launch the process and -[NSTask suspend] to suspend it (and your question should have gone to the Cocoa-Dev list).
You won't easily be able to use task_suspend(). It's part of the Mach APIs, which are esoteric and Apple discourages their use because they aren't officially public APIs.
You can send a process SIGSTOP using the kill() system call to suspend it and then use SIGCONT to unsuspend it.
Regards,
Ken
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden