Retreving event type from wait_for_objects[_etc]()

Hi all. I’m trying to port my HTTP server, which uses epoll, to Haiku. From what I can find on Google and this forum. The closest thing I can use is wait_for_objects (or select, but that is very slow). However, my code expects the waiting function tell it which event has happened. For example, the a read occurred or is it a write. But from the description of wait_for_objects. It seems it simply waits until events in a list of specified events to happen. Without gathering a list of what happened. Is there a way around it?

From reading the description of the function, it looks like that once wait_for_objects returns, the passed in array of object_wait_info structs will be updated to only contain the events that actually occurred.

I hope this helps! :slight_smile:

I can confirm this happens! This does mean that you will have to reset the event mask you are waiting for each cycle.

Thanks! I should have read the comments more carefully.

@nielx How does wait_for_objects perform compared to poll/select? I seems that like poll, wait_for_objects still requires sending all file descriptors each time waiting. So I assume it’s the same level of speed?

I don’t know, but it seems likely that it has the same drawbacks as poll/select.

Thanks all. My HTTP server works now!