nemequ / sqlheavy

Automatically exported from code.google.com/p/sqlheavy
Other
5 stars 4 forks source link

QueryResult.next_internal_async() completes in background thread context #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
QueryResult.next_internal_async() uses a background thread to do its thing, 
then directly calls the completion callback.  This is a problem when coding 
with GTK (and most likely other toolkits as well) as it's not particularly good 
with threads.

The attached patch schedules the callback on the calling thread's default 
context to be run at idle time.

Original issue reported on code.google.com by jim%yorb...@gtempaccount.com on 24 Jun 2011 at 10:48

Attachments:

GoogleCodeExporter commented 9 years ago
commit e345127854c67e655bb958edc1d1e391c36292ff
Author: Jim Nelson <jim@yorba.org>
Date:   Fri Jun 24 15:36:59 2011 -0700

    Complete async calls in the thread context first called from.

    SQLHeavy.QueryResult.next_internal_async() was sometimes completing the
    call in a background thread's context rather than the thread context of
    the caller.  This is problematic for GTK work.

    This patch now schedules the callback on the thread's default
    MainContext in the idle loop.

    Fixes bug 9.

Original comment by nem...@gmail.com on 28 Jun 2011 at 9:06