Unified moved_monitor_wait() for moved - #520
Conversation
| pfd.fd = monitor_fd; | ||
| pfd.events = POLLIN; | ||
|
|
||
| return (poll(&pfd, 1, blocking ? -1 : 0) > 0); |
There was a problem hiding this comment.
moved_monitor_get_fd() returns -1, so poll() ignores it. Blocking waits forever and nonblocking always returns false, preventing the CFRunLoop from processing controller events. Could this wait through the CFRunLoop instead?
| moved_monitor_free(monitor); | ||
| #else | ||
| while (true) { | ||
| moved.handle_request(); |
There was a problem hiding this comment.
handle_request() blocks in recvfrom(), so a controller notification alone cannot reach moved_monitor_wait(). Potentially the socket and monitor event could be multiplexed, or the socket made nonblocking, so monitor wakes the daemon without a UDP request?
| static_cast<unsigned long>(GetLastError())); | ||
| } | ||
|
|
||
| return true; |
There was a problem hiding this comment.
This returns true even when a nonblocking wait returns WAIT_TIMEOUT. Could this return true only for WAIT_OBJECT_0 or a fallback rescan, and false for a nonblocking timeout?
|
Thanks for getting this out, when I boot the pi up again, I can test out with the newest Joustmania on linux (we've upgraded to the newest psmoveapi), and will report back |
A cleanup on top of #519 for unifying monitor waiting between macOS, Linux and Windows.
Tested:
Not tested:
psmove pair -don any OSpsmove daemonon any OScc @adangert if you could check if this works for you, that'd be great :)