hola, situation: fltk 1.1.9 there is a worker thread that receives midi and puts the events into a ringbuffer. i tried two methods to get the data from the ringbuffer to the main thread:
1. add_timeout, fl_repeat_timeout the cb just always peaks into the buffer if something is new. disadvantage: to get reasonable performance the timeout should be somewhat low (like 0.1 or better 0.01) but that causes the CPU to be used all the time. advantage: it never locks on the mac when i move windows around, data keeps flowing. 2. add_fd i created a pipe to "signal" the cb. the worker writes into the pipe when new data has been written, the reader reads from both the pipe and the buffer. advantage: works beautifully in linux, CPU is idling when it should. disadvantage: blocks the main thread on the mac and the buffer overflows. i tried to explcitely set the O_NONBLOCK flags on the pipes reader and writer fd but it didn't change anything. why does the add_timeout work even when i move windows around and the add_fd methos blocks? do you have any other ideas on how i could get a nonblocking fd_add cb on the mac to "signal" my main thread? since, on windows, pipes are not supported would you recommend to use add_handler and call SendMessage(ui, some_unrecognized_event, 0, 0) from the worker? i'd really like to let the reader idle on all three platforms. currently i only got it working lockfree in linux. ty, JanE _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

