steinbergmedia / vst3_pluginterfaces

VST 3 API
Other
24 stars 18 forks source link

IEventHandler::onFDIsSet interface can be improved #2

Closed abique closed 5 years ago

abique commented 6 years ago

https://github.com/steinbergmedia/vst3_pluginterfaces/blob/de91bf4199959f9496cf6d14990fce037435ade5/gui/iplugview.h#L224

Hi, This is likely being called back after a select/poll/epoll reactor. Ideally it should also specify if the fd is ready for read/write, so we can save a poll() to get that information. Alex.

abique commented 6 years ago

Also I would suggest an other name for the method:

onFdEvent(int fd, int eventMask)

where eventMask would tell you if there is input available, output can be written, disconnection or error. You can check poll or epoll.

abique commented 6 years ago

Forget about this one.

abique commented 6 years ago

I re-open because this interface needs to be either simplified or more advanced:

scheffle commented 6 years ago

Can you give me a use case where you register a file descriptor for event handling where the communication is not bidirectional ? Only notifying about readability did not work with GTK.

abique commented 6 years ago

If you register an fd from epoll_create(), you only need the read I think and then you can have your own fd reactor.

Usually you turn off events for writing and only when you want to write something you first try to write and if you received EWOULDBLOCK then you activate the write event and wait for it to write. If write is always on, then your polling mechanism will always return to tell you "write is ready" even if you don't have anything to write.

Is that correct?

scheffle commented 6 years ago

OK, I just rechecked, and there's a bug in the example host which lead me to the conclusion that a notification of writability is needed, but that is not the case. So we will change the documentation that only readability will be notified.

abique commented 6 years ago

OK Very good, thanks :)

Then I'll implement it as specified in the next days.