Re: [gnome-db] Introducing non blocking (asynchronous) functions in libgda



On 4/20/05, DANIELLLANO <DANIELLLANO terra es> wrote:
> Vivien Malerba wrote:
> > On 4/19/05, DANIELLLANO <DANIELLLANO terra es> wrote:
> > > Vivien Malerba wrote:
> > > > I want to introduce non blocking (asynchronous) functions in libgda.
> > >
> > > Great to know about that!!!
> > >
> > > I'd like to see libgda having all the current blocking functions moving
> > > to non blocking functions.
> > >
> > > Do you have any more specific plans about that?
> >
> > I've written a small object (GdaThreader) which makes it easy to run a
> > new thread and be notified when the thread finishes (the notification
> > itself occurs in an idle loop in the main thread, not in the thread
> > which has finished, which makes it easy to use it with GTK). That
> > object needs a bit more work (add mutexes to some variables) and is
> > useable (Mergeant uses it).
> >
> > I planned to use it in libgda to make asynchronous queries to a
> > GdaConnection (thus creating a
> > gda_connection_execute_single_command_async() method), but I don't
> > have a timetable for that, and it's not on my current TODO list.
> >
> > Adding asynchronous calls to other parts of libgda should not be very
> > difficult, but beware that no internal variable or object is thread
> > aware at this point...
> >
> > The GdaThreader object is quite simple by itself, and you can see how
> > it's used in mergeant.
> 
> Is GdaThreader very Gda specific or is it general enough to be included
> in glib?

It's not specific to libgda in any way as it uses only GLib features.
However, it does not make your application thread-safe: if the other
thread sends signals, or modify some variables, the signals treatment
or the variables should be protected to be thread-safe. So it must be
used with great care (as for any multi-threaded application).

Basically I plan to use it in libgda/libgnomedb/mergeant only to run
blocking functions (typically runing a query by a database, loading a
_new_ dictionnary from a file in libgnomedb, or opening a connection
in mergeant).

About having such an object in GLib, I don't know. It certainly fills
a need though.

> 
> Are you publishing your intermediate work for comments?

All my work is open for comments/critics... The GdaThreader still
needs some work, though to make it itself fully thread-safe and is not
yet included in libfda's documentation.

Vivien



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