nadjieb / cpp-mjpeg-streamer

C++ MJPEG over HTTP Library
MIT License
139 stars 39 forks source link

terminate called after throwing an instance of 'std::runtime_error' revents != POLLWRNORM #38

Closed chenscottus closed 1 year ago

chenscottus commented 1 year ago

Hello,

Could you please explain to me what this error means, and how to resolve it? if (payload.second.revents != POLLWRNORM) { throw std::runtime_error("revents != POLLWRNORM\n"); } //terminate called after throwing an instance of 'std::runtime_error' revents != POLLWRNORM

Many thanks!

-Scott

chenscottus commented 1 year ago

sys/poll.h

define POLLWRNORM 0x0100 / Writing now will not block /

chenscottus commented 1 year ago

http://www.qnx.com/developers/docs/6.5.0SP1.update/index.html#com.qnx.doc.neutrino_lib_ref/p/poll.html#id9 POLLWRNORM Equivalent to POLLOUT. The significance and semantics of normal, priority, and high-priority data are file- and device-specific.

If the value of fd is less than 0, events is ignored, and revents is set to 0 in that entry on return from poll().

In each pollfd structure, poll() clears the revents member, except that where the application requested a report on a condition by setting one of the bits of events listed above, poll() sets the corresponding bit in revents if the requested condition is true. In addition, poll() sets the POLLHUP, POLLERR, and POLLNVAL flag in revents if the condition is true, even if the application didn't set the corresponding bit in events.

If none of the defined events occurs on any selected file descriptor, poll() waits at least timeout milliseconds for an event to occur on any of the selected file descriptors. If the value of timeout is 0, poll() returns immediately. If the value of timeout is -1, poll() blocks until a requested event occurs or until the call is interrupted.

The poll() function isn't affected by the O_NONBLOCK flag.

The poll() function reports regular files, terminal and pseudo-terminal devices, FIFOs, and pipes.

Regular files always poll TRUE for reading and writing.

A file descriptor for a socket that's listening for connections indicates that it's ready for reading, once connections are available. A file descriptor for a socket that connects asynchronously indicates that it's ready for writing, once a connection has been established.

chenscottus commented 1 year ago

After running a few days in ubuntu 20.04, It means we cannot write the encode image to the stream ...