ThreadSafe issue with CFSocket
ThreadSafe issue with CFSocket
- Subject: ThreadSafe issue with CFSocket
- From: Pranav Kumar Sahu <email@hidden>
- Date: Fri, 19 Dec 2003 20:09:41 +0530
Hi,
I have an application that does Socket level calls. I am using
CFSocket for callback functionality with native socket.
For each connection I am doing an accept with following code :
CFSocketContext socketCtxt = {0,callinfoptr,NULL,NULL,NULL};
// callinfoptr contains my data which I need to send to my callback.
s = CFSocketCreateWithNative(NULL,socket,
kCFSocketAcceptCallBack,dealWithAcceptSocket, &socketCtxt);
//socket is my native socket and "dealWithAcceptSocket" is my
callback function
CFSocketSetSocketFlags(s, !kCFSocketAutomaticallyReenableAcceptCallback);
//I am setting this option b'coz i want to accept only one
connection. For second connection
//user needs to register again with CFSocket and do an accept.
source = CFSocketCreateRunLoopSource(NULL, s, 0);
CFRunLoopAddSource(CFRunLoopGetCurrent(), source,kCFRunLoopDefaultMode);
After i get my callback i will invalidate the object and using
CFSocketInvalidate(s);
Same has done for Read and Send. It works fine with no thread. When i put
this code in multi thread environment CFSocketInvalidate(s); crashes with
send callback.
Am i doing some thing wrong ? or CFSocket objects are not thread safe ?
Rgds
Pranav Kumar Sahu
QUARK MEDIA
Ext :9742
[demime 0.98b removed an attachment of type application/ms-tnef]
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.