• 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
RE: Is it thread safe ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Is it thread safe ?


  • Subject: RE: Is it thread safe ?
  • From: Pranav Kumar Sahu <email@hidden>
  • Date: Fri, 11 Apr 2003 15:10:54 +0530

>>When working with CF stuff, it's important to remember that each
>>thread has its own run loop, and that when you install a CF event
>>source into a run loop, the callbacks will always be called by that
>>run loop.

>>Which means that the following isn't true...

>Since I have CFRunLoop, I don't need to know which thread's callback will
>get called when data arrives right ?

>>The thread that calls the callback is always the thread whose run
>>loop you installed the event source into.

Yes, so proper thread's callback will get called. Let's take an example. I
have two threads. 1st one i will attach a source for receive and second one
for send. If event occurs for receive on particular source, callback will be
called in 1st thread.
Am i right ?

If there is multiple threads accessing my library, I don't have to keep
track of the threads. As proper thread will be active, when a proper RunLoop
gets active, when proper message comes to my source attached.

I am using global link-list to get data in callback. I am able to send it
through CFSocketContext. For which I am allocating memory using malloc. And
I am disposing too. Is there a way to allocate(may be by CFAllocator) to
allocate memory and it should dispose memory, if I invalid my source. If
CFAllocator is the right choice to do this, is there any sample code
available. I could not find any documentation on this.

ThanX
--Pranav
_______________________________________________
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.

  • Prev by Date: Re: Identifying port names for users
  • Next by Date: Proxies, Bytes, and CFNetwork
  • Previous by thread: RE: Is it thread safe ?
  • Next by thread: Identifing port names for users
  • Index(es):
    • Date
    • Thread