Re: Right way to tap into the main loop



The right way to "tap" into the main loop is to add a file descriptor on which the main loop can poll.
In you case it sounds like this is exactly what you could do with the TTY's fd.

If you really need to communicate between 2 threads, just write onto one end a pipe and let the mainloop stuff poll onto the receiving end of that pipe.

-
Lionel

On 10/08/14 23:20, Elias Bakken wrote:
Hi!

I'm using Python for this:
I'm in need of setting up a loop that checks for messages from a virtual TTY and displays the
message once it comes in. Since Clutter.main() hogs the main thread, setting up a normal thread from the main thread does nothing. Setting up a separate process circumvents this, but I see no way of
passing the message back to the main thread which has the stage handle etc.

Is it possible to use a ClutterEvent or signals for this?

I've managed to implement a working version using a time-line that signals a a check
for new messages every 0.1 seconds, but if would be way cleaner to have an actor or whatever
that emits a signal when a message is on queue.

Any takers for this? I guess really the question is how to subclass some event class and override or create a new signal method..

Kind regards, 
-Elias


_______________________________________________
clutter-list mailing list
clutter-list gnome org
https://mail.gnome.org/mailman/listinfo/clutter-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]