void QEventDispatcherBlackberry::unregisterSocketNotifier(QSocketNotifier *notifier) { Q_D(QEventDispatcherBlackberry); int sockfd = notifier->socket(); qEventDispatcherDebug << Q_FUNC_INFO << "fd =" << sockfd; if (Q_UNLIKELY(sockfd >= FD_SETSIZE)) { qWarning() << "QEventDispatcherBlackberry: cannot unregister QSocketNotifier" << sockfd; return; } // Allow the base Unix implementation to unregister the fd too (before call to ioEvents()!) QEventDispatcherUNIX::unregisterSocketNotifier(notifier); // Unregister the fd with bps BpsChannelScopeSwitcher channelSwitcher(d->bps_channel); int result = bps_remove_fd(sockfd); if (Q_UNLIKELY(result != BPS_SUCCESS)) qWarning() << "QEventDispatcherBlackberry: bps_remove_fd failed" << sockfd; const int io_events = ioEvents(sockfd); // if other socket notifier is watching sockfd, readd it if (io_events) { result = bps_add_fd(sockfd, io_events, &bpsIOHandler, d->ioData.data()); if (Q_UNLIKELY(result != BPS_SUCCESS)) qWarning("QEventDispatcherBlackberry: bps_add_fd error"); } }
void QEventDispatcherBlackberry::unregisterSocketNotifier(QSocketNotifier *notifier) { // Allow the base Unix implementation to unregister the fd too QEventDispatcherUNIX::unregisterSocketNotifier(notifier); // Unregister the fd with bps int sockfd = notifier->socket(); const int io_events = ioEvents(sockfd); int result = bps_remove_fd(sockfd); if (result != BPS_SUCCESS) qWarning() << Q_FUNC_INFO << "bps_remove_fd() failed" << sockfd; /* if no other socket notifier is * watching sockfd, our job ends here */ if (!io_events) return; Q_D(QEventDispatcherBlackberry); errno = 0; result = bps_add_fd(sockfd, io_events, &bpsIOHandler, d->ioData.data()); if (result != BPS_SUCCESS) { qWarning() << Q_FUNC_INFO << "bps_add_fd() failed" << strerror(errno) << "code:" << errno; } }
void QEventDispatcherBlackberry::registerSocketNotifier(QSocketNotifier *notifier) { Q_ASSERT(notifier); Q_D(QEventDispatcherBlackberry); int sockfd = notifier->socket(); int type = notifier->type(); qEventDispatcherDebug << Q_FUNC_INFO << "fd =" << sockfd; if (Q_UNLIKELY(sockfd >= FD_SETSIZE)) { qWarning() << "QEventDispatcherBlackberry: cannot register QSocketNotifier (fd too high)" << sockfd; return; } // Register the fd with bps BpsChannelScopeSwitcher channelSwitcher(d->bps_channel); int io_events = ioEvents(sockfd); if (io_events) bps_remove_fd(sockfd); switch (type) { case QSocketNotifier::Read: qEventDispatcherDebug << "Registering" << sockfd << "for Reads"; io_events |= BPS_IO_INPUT; break; case QSocketNotifier::Write: qEventDispatcherDebug << "Registering" << sockfd << "for Writes"; io_events |= BPS_IO_OUTPUT; break; case QSocketNotifier::Exception: default: qEventDispatcherDebug << "Registering" << sockfd << "for Exceptions"; io_events |= BPS_IO_EXCEPT; break; } const int result = bps_add_fd(sockfd, io_events, &bpsIOHandler, d->ioData.data()); if (Q_UNLIKELY(result != BPS_SUCCESS)) qWarning() << "QEventDispatcherBlackberry: bps_add_fd failed"; // Call the base Unix implementation. Needed to allow select() to be called correctly QEventDispatcherUNIX::registerSocketNotifier(notifier); }
void QEventDispatcherBlackberry::registerSocketNotifier(QSocketNotifier *notifier) { Q_ASSERT(notifier); // Register the fd with bps int sockfd = notifier->socket(); int type = notifier->type(); int io_events = ioEvents(sockfd); if (io_events) bps_remove_fd(sockfd); // Call the base Unix implementation. Needed to allow select() to be called correctly QEventDispatcherUNIX::registerSocketNotifier(notifier); switch (type) { case QSocketNotifier::Read: io_events |= BPS_IO_INPUT; break; case QSocketNotifier::Write: io_events |= BPS_IO_OUTPUT; break; case QSocketNotifier::Exception: default: io_events |= BPS_IO_EXCEPT; break; } Q_D(QEventDispatcherBlackberry); errno = 0; int result = bps_add_fd(sockfd, io_events, &bpsIOHandler, d->ioData.data()); if (result != BPS_SUCCESS) qWarning() << Q_FUNC_INFO << "bps_add_fd() failed" << strerror(errno) << "code:" << errno; }