Hi,
I'm using CFReadStream to implement HTTP communication in a client/
server application. For various reasons, I create a thread using BSD
call pthread_create() and call CFRunLoop() to start the run loop. On
the other thread, I create a CFReadStream object, set the callback
functions, and schedule the read stream into the run loop. Client
program is required to update server continuously and this means
that the program needs to keep scheduling and unscheduling read
streams from the run loop.
The way the read stream is unscheduled from the run loop is:
CFReadStreamClose(m_hCFNetworkReadStream);
CFReadStreamSetClient(m_hCFNetworkReadStream,
kCFStreamEventNone, NULL, NULL);
CFReadStreamUnscheduleFromRunLoop(m_hCFNetworkReadStream,
m_hRunLoop, kCFRunLoopDefaultMode);
CFRelease(m_hCFNetworkReadStream);
m_hCFNetworkReadStream = NULL;
The problem is that occasionally (very often actually) the program
crashes while unscheduling read stream and the call stack is:
CFGetTypeID
_CFTypeUnscheduleFromMultipleRunLoops
AddressLookupPerform
_CFRunLoopDoSource
_CFRunLoopRun
CFRunLoopRunSpecific
CFRunLoopRun
, then myprogram's Run()
I've been struggled for quite a while. Please help.
Patrick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/macnetworkprog/email@hidden
This email sent to email@hidden