Cross-thread event dispatch

88 views
Skip to first unread message

Clement JACOB

unread,
Jan 19, 2013, 4:02:57 AM1/19/13
to kivy-...@googlegroups.com
Hi everybody,

I just wanted to know if there is a way to dispatch an event from a given thread, and then catch the event in the Application, in another thread. There is a similar feature in Qt framework (with signals/slots).

I made a basic test with bind, which shows the current thread when code is running, and given the results, I assume the event callback is called from the dispatcher thread, which is not what I want.

Anyway, is it ok to dispatch events from another thread? Can it cause errors? If no, I can create a thread safe queue to synchronize the 2 threads (pushing the event in the callback into the queue, and poping from the queue in main thread).

I think it would be very usefull having a way to retrieve events in main thread, whatever the dispatcher thread.

Thanks!

Akshay Arora

unread,
Jan 20, 2013, 5:42:27 PM1/20/13
to kivy-...@googlegroups.com
Performing any GUI based operation out of the main thread can lead to a segmentation fault.

Calling a method through Clock.schedule_*  should run the method in the main thread.

Regards.


--
 
 

Reply all
Reply to author
Forward
0 new messages