-#ifdef USE_COCOA_SOURCES
-
-/* whether there is data available to be read on the file descriptor
- */
-static int
-input_available_p (int fd)
-{
- struct timeval tv = { 0, };
- fd_set fds;
- FD_ZERO (&fds);
- FD_SET (fd, &fds);
- return select (fd+1, &fds, NULL, NULL, &tv);
-}
-
-
-static void
-jwxyz_source_cb (CFSocketRef s, CFSocketCallBackType type,
- CFDataRef address, const void *call_data, void *info)
-{
- struct jwxyz_XtInputId *data = (struct jwxyz_XtInputId *) info;
-
- if (type != kCFSocketReadCallBack) abort();
- if (call_data != 0) abort(); // not used for kCFSocketRead
-
- // We are sometimes called when there is not, in fact, data available!
- // So don't call data->cb if we're being fed a pack of lies.
- //
- if (! input_available_p (data->fd)) {
- LOGI(@"source 0x%08X %2d: false alarm!\n", (unsigned int) data, data->fd, 0);
- return;
- }
-
- LOGI(@"source 0x%08X %2d: fire\n", (unsigned int) data, data->fd, 0);
-
- data->cb (data->closure, &data->fd, &data);
-}
-
-#endif /* USE_COCOA_SOURCES */
-
-