Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Launching NSTask from a Thread

Launching NSTask from a Thread
Thread Tools
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
May 31, 2003, 12:52 AM
 
When I try to launch an instance of NSTask from a detached thread, my test app quits and sends the message below to the console.


TomcatWrapper has exited due to signal 5 (SIGTRAP).


I think is because NSTask initiates and runs on its own thread and since I'm launching NSTask from within a detached thread then things get kinda loopy somewhere.

How about it guys, any ideas?

Thanks!


     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
May 31, 2003, 03:55 AM
 
Are you certain that this will work even in the main thread? Because really, I can't see any obvious way that being in a separate thread would hurt NSTask like you seem to be saying. As the name implies, the task executes not just in another thread, but as an entirely separate task. It doesn't share memory with the calling program, so it can't really conflict with it.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
DaGuy  (op)
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
May 31, 2003, 09:24 AM
 
I hear you. I guess this error is due to some other reason. Let me poke around some more.

So launching a thread from within another thread is fine. Not so different (at least in principle) from the main thread detaching threads. What about recursively detaching threads? i.e., one thread, launches a thread and that thread launches another thread and son on... Say N times. N finite :-)

I know the complexity would increase greatly and I would bet that their is rarely, if any, need for something like this but I just want to understand this topic a little better.

Is it equivalent from a resource allocation perspective (memory, CPU) to having the main thread detach N threads?


Thanks!

     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:37 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2