RE: Is there only one CFRunLoopRun which can implement in one process
RE: Is there only one CFRunLoopRun which can implement in one process
- Subject: RE: Is there only one CFRunLoopRun which can implement in one process
- From: Chris Gardner <email@hidden>
- Date: Sun, 17 May 2009 20:38:29 +0800
- Importance: Normal
I want to download two files at the same time, so I create two thread in which set up CFRunLoopRun.
In each run loop , there is a global function to receive date from FTP server.
And after finishing downloading the desired file, I will kill the run loop with CFRunLoopRun(CFRunLoopGetCurrent),
then the second thread will begin to download file with the same global function.
Why the second thread will block until the first thread finished download task.
I want to download file parallelly.
I'm sorry for pure English.:)
Regards,
Chris Wu
> From: email@hidden
> To: email@hidden
> Date: Sun, 17 May 2009 06:53:44 -0500
> CC: email@hidden
> Subject: Re: Is there only one CFRunLoopRun which can implement in one process
>
> On May 17, 2009, at 12:04 AM, Chris Gardner wrote:
>
> > I have created two thread, and in each thread I call CFRunLoopRun
> > function to download file from FTP server.
>
> It should not be necessary to create two threads. The whole point of
> run loops is that they manage multiple asynchronous input sources,
> allowing your program to process events from any of them as they
> occur. It should be possible to manage multiple simultaneous FTP
> downloads at once from your program's main thread.
>
> That said, what API are you using to perform the FTP downloads?
> Running the run loop is part of the basic infrastructure. It doesn't
> have anything to do with FTP downloads, specifically. You must be
> using some other API built on top of a run loop, right? It may be
> best to show your code.
>
>
> > Can the CFRunLoopRun function implement in two PROCESS, but not in
> > two THREAD.
>
> It is possible to have two threads within the same process, each
> running their own run loop. The two will run independently and are
> capable of processing input sources simultaneously.
>
> If you're seeing your FTP downloads being serialized, then it's due to
> something else. The problem isn't a limitation of run loops.
>
> Regards,
> Ken
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_________________________________________________________________
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden