• 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
ThreadSafe issue with CFSocket
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: ThreadSafe issue with CFSocket
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: RE: ResoveALias fails when Apple Talk in Inactive
  • Next by Date: Re: ThreadSafe issue with CFSocket
  • Previous by thread: source for OS X Server ftpd?
  • Next by thread: Re: ThreadSafe issue with CFSocket
  • Index(es):
    • Date
    • Thread