def _stop_on_read(fd):
 _triggered.clear()
 fdref = CFFileDescriptorCreate(None, fd, False, _c_input_callback, None)
 CFFileDescriptorEnableCallBacks(fdref, kCFFileDescriptorReadCallBack)
 source = CFFileDescriptorCreateRunLoopSource(None, fdref, 0)
 loop = CFRunLoopGetCurrent()
 CFRunLoopAddSource(loop, source, kCFRunLoopCommonModes)
 CFRelease(source)

def _stop_on_read ( fd ) : _triggered . clear ( ) fdref = CFFileDescriptorCreate ( None , fd , False , _c_input_callback , None ) CFFileDescriptorEnableCallBacks ( fdref , kCFFileDescriptorReadCallBack ) source = CFFileDescriptorCreateRunLoopSource ( None , fdref , 0 ) loop = CFRunLoopGetCurrent ( ) CFRunLoopAddSource ( loop , source , kCFRunLoopCommonModes ) CFRelease ( source )
register callback to stop eventloop when theres data on fd .