Hi all, just to have confirmation of what I am doing. My app is multithreaded ; the main() loop and some other working threads, receiving / sending data and doing calculations.
The question: what is the correct way to fire a graphics update from a thread ? My work (omitted all sanity checks): - main: ..... static int fd_refresh[2]; ..... pipe(fd_refresh); SetNonblocking(fd_refresh[0]); SetNonblocking(fd_refresh[1]); Fl::add_fd(fd_refresh[0], Do_refresh_callback, NULL); ..... #define CMD_REFRESH 0 ..... static void Do_refresh_callback(int fd, void *data) { unsigned int val; while(read(fd, &val, sizeof(val)) > 0) { switch(val) { case CMD_REFRESH: // HERE I can draw to screen ! break; ..... } } ..... } - A thread receives data and wants to update a drawing. It cannot do it directly, so it writes to fd_refresh[1] an integer which values represent what I want to do (full redraw(), partial updates, etc.) . Fltk then will call Do_refresh_callback and there I will be safe drawing anything. Is this sequence correct ? Now it's working without (apparent) problems. Thanks, regards Lucio _______________________________________________ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk