• 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: waiting on a thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: waiting on a thread


  • Subject: Re: waiting on a thread
  • From: Fritz Anderson <email@hidden>
  • Date: Mon, 13 Dec 2004 10:58:16 -0600

Spawning a thread, and then doing nothing until the thread completes, is the same thing as calling the thread's main procedure without bothering with a thread. Yes, it defeats the purpose of having a thread.

I gather your main thread of execution is done with your files once it has handed them off to the processing thread. Why not have the processing thread take ownership of those files, and delete them itself when it is done?

If it's more complicated than that, you'll have to work out some sort of reference-counting scheme for the files, deleting when the count goes to zero. (But the increment for the processing thread's claim would have to be made before that thread is started.)

	-- F

On 13 Dec 2004, at 10:17 AM, Dennis Falling wrote:

Is there any way to have a method spawn a thread, then wait for that thread to end before continuing with other calls in that method? Does this negate the purpose of threads? Basically, I'm calling a method which will use a few files, and then deleting those files in the calling method. However, since the method call is a new thread, I'm deleting the files before that thread ever gets to them. Ideas?

 --
Fritz Anderson
Consulting Programmer				Chicago, Illinois
http://resume.manoverboard.org/

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: waiting on a thread
      • From: Dennis Falling <email@hidden>
References: 
 >waiting on a thread (From: Dennis Falling <email@hidden>)

  • Prev by Date: Re: waiting on a thread
  • Next by Date: Re: Trouble reading a binary file.
  • Previous by thread: Re: waiting on a thread
  • Next by thread: Re: waiting on a thread
  • Index(es):
    • Date
    • Thread