• 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
Use CFRunLoop to simulate WaitForMultipleObejcts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Use CFRunLoop to simulate WaitForMultipleObejcts


  • Subject: Use CFRunLoop to simulate WaitForMultipleObejcts
  • From: "Alex Guo" <email@hidden>
  • Date: Wed, 15 Dec 2004 11:42:46 +0800

Hi, All
 
  I'm now involved in a networking porting project. I use CFRunLoop to simulate
WaitForMultipleObjects (API on Windows platform), but the following function works
only when just one runloopsource is registered with the runloop. When more than
one runloopsource are registered, it always timeout... What should I do?
Any tips are highly appreciated. thanks in advance.
 
DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE* lpHandles,
        BOOL  bWaitAll, DWORD dwMilliseconds)
{
 PENCAP_EVENT *eventPointerArray = (PENCAP_EVENT *)lpHandles;
 CFRunLoopRef curRunLoop  = CFRunLoopGetCurrent();
 int cnt;
 for(cnt = 0; cnt < nCount; cnt++) {
  CFRunLoopAddSource(curRunLoop, eventPointerArray[cnt]->source, kCFRunLoopCommonModes);
 }
 
 // Run the CFRunLoop kCFRunLoopDefaultMode
 SInt32 result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, (dwMilliseconds/1000), true);
 
 // Remove RunLoopSource
 for(cnt = 0; cnt < nCount; cnt++) {
  CFRunLoopRemoveSource(curRunLoop, eventPointerArray[cnt]->source, kCFRunLoopCommonModes);
 }
 
 if(result == kCFRunLoopRunTimedOut) {
  // timeout
  return WAIT_TIMEOUT;
 }
 if(result != kCFRunLoopRunHandledSource) {
  // wait failed
  return WAIT_FAILED;
 }
 
/////////////////////////////////////////////// the following code here has no effect
 
 
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Use CFRunLoop to simulate WaitForMultipleObejcts
      • From: Boaz Stuller <email@hidden>
  • Prev by Date: Re: generating KEEPALIVE packets
  • Next by Date: Substituting low level BSD stuff with spiffy Cocoa calls
  • Previous by thread: SMB only shows file name length < 12
  • Next by thread: Re: Use CFRunLoop to simulate WaitForMultipleObejcts
  • Index(es):
    • Date
    • Thread