<div dir="ltr">I see, on the server side there are helpful APIs like wl_event_loop_add_timer and wl_event_source_timer_update to integrate timers into event loop but unfortunately not so on client side. I guess it might not make sense for libwaylandclient to have such APIs but instead the app/toolkits that implement the client part must have custom APIs coarsely mirroring the server's functionality. From what i understand from the file you pointed to it mainly does -<div>1) create main epoll_fd during setup</div><div>2) add display_fd to epoll_fd and the corresponding task handler and user data</div><div>3) create and add timer_fd to the epoll_fd with its own task handler and user_data</div><div><br></div><div>in main event loop of my simple app just keep performing epoll_wait like in the file and invoke task handlers for generated events.</div><div><br></div><div>I will try to get this integrated into my app and post issues if any. Thank you for all the help.<div><div><br></div><div>- VirtualPresence<br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 30, 2014 at 1:16 AM, Pekka Paalanen <span dir="ltr"><<a href="mailto:ppaalanen@gmail.com" target="_blank">ppaalanen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, 29 Oct 2014 08:48:12 -0700<br>
Virtual Presence <<a href="mailto:virtualpresence.ucla@gmail.com">virtualpresence.ucla@gmail.com</a>> wrote:<br>
<br>
> Thank you for the detailed gyaan. I will look into the "sub-surface"<br>
> protocol as an alternative. What I do as of now is have the 2 threads on a<br>
> 3 second timer where threadA renders triangle for 3 seconds then signals a<br>
> mutex condition and wakes up threadB which renders gears for 3 seconds and<br>
> so on and so on. I will also look into the option of reusing the wl_surface<br>
> for multiple wl_egl_window. This seems closest to what i had in mind. I<br>
> would also like to attach 3 second timer signal to the display FD and the<br>
> custom queue i have setup for the 2 threads so that instead of having a<br>
> dedicated timer logic I can blend the event handling into the Wayland<br>
> model. I haven't been successful in doing this though. As an alternative I<br>
> am looking into the option of writing a wl_timer protocol to provide the<br>
> functionality. Any suggestions on how i can tie in the timer logic or any<br>
> comments on having a dedicated wl_timer protocol? Thank you for all the<br>
> help.<br>
<br>
</span>Don't do anything with protocol about timers, unless your only goal is<br>
to learn how to define new protocols by a throw-away toy example.<br>
<br>
Your client is already polling the wayland connection fd. You can just,<br>
say, use timerfd API to create an fd for your timer needs, and simply<br>
add that to the poll set. That is what<br>
<a href="http://cgit.freedesktop.org/wayland/weston/tree/clients/window.c" target="_blank">http://cgit.freedesktop.org/wayland/weston/tree/clients/window.c</a><br>
already does (look for display_watch_fd), for instance.<br>
<br>
Or use an event library that offers you everything in a portable<br>
fashion. Or a real toolkit.<br>
<br>
<br>
Thanks,<br>
pq<br>
</blockquote></div><br></div></div></div></div></div>