Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Creating Thread and RunLoop



Guys,

The methods below is a new thread that I create to handle streaming data.
After creation of the thread, i registered read and write stream to the runloop, and open them.
Then i call the CFRunLoopRun to start my run loop.
It just does won't recieve the completion event of those two streams.

I think the problem is that i open those streams before the runloop starts, but where else should i open those stuffs?

void SocketThread(void* param)
{
..............
    CFReadStreamSetClient(readStream, registeredEvents, sockReadCallBack, &context);
    CFReadStreamScheduleWithRunLoop(readStream, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);
    CFWriteStreamSetClient(writeStream, registeredEvents, sockWriteCallBack, &context);
    CFWriteStreamScheduleWithRunLoop(writeStream, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);
   
    CFReadStreamOpen(readStream);
    CFWriteStreamOpen(writeStream);
...............  
    CFRunLoopRun();
}


Thanks,
-Hao
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.