21 return inOutStr <<
"MasterPort instance " << hex << &inObj << dec <<
" portRef " << hex << inObj.
GetPortRef () << dec <<
" " << (inObj.
IsOkay () ?
"OK" :
"Not OK");
29 IONotificationPortRef masterPortRef (
NULL);
31 assert (masterPortInstance &&
"Must have valid MasterPort instance");
32 if (masterPortInstance)
34 masterPortRef = *masterPortInstance;
35 assert (masterPortRef &&
"Must have valid masterPortRef");
59 if (!outObj->IsOkay ())
62 catch (std::bad_alloc)
70 MasterPort::MasterPort ()
77 mpMasterPort = IONotificationPortCreate (kIOMasterPortDefault);
80 cerr <<
"IONotificationPortCreate returned NULL" << endl;
83 CFRunLoopSourceRef pRunLoopSource (IONotificationPortGetRunLoopSource (mpMasterPort));
86 cerr <<
"IONotificationPortGetRunLoopSource returned NULL" << endl;
89 CFRunLoopAddSource (CFRunLoopGetCurrent (), pRunLoopSource, kCFRunLoopDefaultMode);
96 cerr << *
this <<
" destructor" << endl;
98 IONotificationPortDestroy (mpMasterPort);
113 cerr <<
"MasterPortDestroyer triggered" << endl;