Quoting Denis Oliver Kropp: > Quoting Josh Green: > > I haven't been able to find any information on how to process directfb > > events and other external events, such as a socket or file, in the same > > thread. I'd like to be able to use the "poll" function to listen for > > activity on a UDP socket as well as events from directfb. The only way I > > see to do this, is to create separate threads (which I'm reluctant to > > do) or wait on directfb events with a small timeout, but that seems > > hackish. Thanks for any tips. > > I'm aware of that issue. Unfortunately, there's no solution > without threads, yet. My solution in XDirectFB is to create a > thread which fetches events from the event buffer and writes > them into a pipe. The read file descriptor is then added to the > fileset. You can read DFBEvent's from that pipe and process them. > > More straightforward would be a function of the event buffer > which creates the pipe itself and returns the read file descriptor > to the application. The event buffer will then write to the pipe > itself. This saves one thread and the overhead of the indirection.
I've just commited a new function IDirectFBEventBuffer::CreateFileDescriptor(). Use that and add the returned file descriptor to the file descriptor set of your select() loop. You still need to call IDirectFBEventBuffer::Reset() to flush the contents afterwards. -- Best regards, Denis Oliver Kropp .------------------------------------------. | DirectFB - Hardware accelerated graphics | | http://www.directfb.org/ | "------------------------------------------" Convergence GmbH -- Info: To unsubscribe send a mail to [EMAIL PROTECTED] with "unsubscribe directfb-dev" as subject.
