• 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
Porting Open Transport Code. Crashing on YieldingNotifier
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Porting Open Transport Code. Crashing on YieldingNotifier


  • Subject: Porting Open Transport Code. Crashing on YieldingNotifier
  • From: Gerry Beggs <email@hidden>
  • Date: Wed, 8 Jun 2005 23:27:20 -0500

Hi. I've just recently started working with MacOS X (a bit late, I know)

I'm trying to port a program I wrote which uses Open Transport.
I'm creating a C++ class to handle data over a connection with a server.

If I DO NOT install a Yielding Notifier, it works fine.
But when I do install it, the program crashes when I call OTBind() before I try to connect to a server.


The crash window says it's crashing inside 'WaitForSyncDone' called from OTBind().

My code is based on nearly identical sample code from Apple: OTSimpleDownloadHTTP.

The only difference between the programs I can find is that mine is C+ + and the sample code is plain C.
I've tried using extern "C" around the yielding notifier with no success.


Any hints on what I might be missing would be greatly appreciated.


MY YIELDING NOTIFIER:

static pascal void yieldingNotifier (void *contextPtr, OTEventCode code, OTResult result, void *cookie)
{
#pragma unused(contextPtr)
#pragma unused(result)
#pragma unused(cookie)


    switch (code)
    {
        case kOTSyncIdleEvent:
            YieldToAnyThread();
            break;
        default:
            // do nothing
            break;
    }
}


THE CODE TO CONNECT TO A SERVER:

ep = OTOpenEndpointInContext(OTCreateConfiguration(kTCPName), 0, nil, &err, nil);

    // If the endpoint opens successfully...
    if (err == noErr)
    {
        // Establish the modes of operation.  This sample uses
        // sync/blocking mode, with sync idle events that yield
        // time using the Thread Manager.
        err = OTSetSynchronous(ep);

        if (err == noErr)
            err = OTSetBlocking(ep);

if (err == noErr)
err = OTInstallNotifier(ep, NewOTNotifyUPP (yieldingNotifier), nil);


        if (err == noErr)
            err = OTUseSyncIdleEvents(ep, true);

        // Bind the endpoint.  Because we're an outgoing connection,
        // we don't have to bind it to a specific address.
        if (err == noErr)
            err = OTBind(ep, NULL, NULL);

THIS IS WHERE IT CRASHES

--
email@hidden       http://www.mts.net/~gbeggs1/

_______________________________________________
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


  • Prev by Date: MIB busted in 10.4?
  • Next by Date: can I send and recv. a Ethernetpacket as Asynch in RAW-MODE ??
  • Previous by thread: MIB busted in 10.4?
  • Next by thread: can I send and recv. a Ethernetpacket as Asynch in RAW-MODE ??
  • Index(es):
    • Date
    • Thread