• 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
crash in CFReadStreamOpen when called from secondary thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

crash in CFReadStreamOpen when called from secondary thread


  • Subject: crash in CFReadStreamOpen when called from secondary thread
  • From: "Shalini Kamala" <email@hidden>
  • Date: Tue, 24 Oct 2006 11:24:22 -0700
  • Organization: AOL

Hello!

I am trying to do an HTTP GET from a secondary thread, & when I call 
CFReadStreamOpen, I get a crash in the debugger.("Program Received Signal: EXC_ARITHMETIC")
The crash occurs in _CFNetConnectionRegisterClass. If I call CFReadStreamOpen from the main thread, it works fine. What am I missing ? Do I need to do any initialization in the secondary thread ?

Thanks,
Shalini

PS:

Here is how I create the thread :
    MPCriticalRegionID criticalRegion;
    OSStatus retStatus = MPCreateCriticalRegion(&criticalRegion);
       
    retStatus = MPEnterCriticalRegion(criticalRegion, 5000*2);
    MPTaskID taskID;
    retStatus = MPCreateTask(&ThreadFunc, strArray, 0, 0, NULL, NULL, 0, &taskID);
    retStatus = MPExitCriticalRegion(criticalRegion);  
    retStatus = MPDeleteCriticalRegion(criticalRegion);


My HTTP GET calls look like this:

        CFStringRef url = "" href="http://10.169.150.209:8080/MetadataUploadServlet?Screenname=foo&Title=Testing&ThumbnailExtension=jpg">http://10.169.150.209:8080/MetadataUploadServlet?Screenname=foo&Title=Testing&ThumbnailExtension=jpg");

        CFURLRef myURL = CFURLCreateWithString(kCFAllocatorDefault, url, NULL);

        CFStringRef requestMethod = CFSTR("GET");

        CFHTTPMessageRef myRequest = CFHTTPMessageCreateRequest(kCFAllocatorDefault, requestMethod, myURL,
                               kCFHTTPVersion1_1);
       

            CFDataRef mySerializedRequest = CFHTTPMessageCopySerializedMessage(myRequest);
            CFReadStreamRef stream = CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, myRequest);
       
            CFStreamClientContext    ctxt      = { 0, (void*)NULL, NULL, NULL, NULL };

            CFReadStreamSetProperty(stream, kCFStreamPropertyHTTPAttemptPersistentConnection, kCFBooleanTrue);
            CFReadStreamSetClient(stream, kNetworkEvents, ReadStreamClientCallBack, &ctxt);
            CFReadStreamScheduleWithRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);
            CFReadStreamOpen(stream);

      
        CFRelease(myRequest);
        CFRelease(myURL);
        CFRelease(url);
        myRequest = NULL;


 _______________________________________________
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: crash in CFReadStreamOpen when called from secondary thread
      • From: "Shalini Kamala" <email@hidden>
    • Re: crash in CFReadStreamOpen when called from secondary thread
      • From: Quinn <email@hidden>
  • Prev by Date: Re: how to enumerate TCP and UDP listeners
  • Next by Date: Preferred Airport wireless networks
  • Previous by thread: Re: Using cfhttp authentication functions when the response was constructed with CFHTTPMessageAppendBytes
  • Next by thread: Re: crash in CFReadStreamOpen when called from secondary thread
  • Index(es):
    • Date
    • Thread