Re: ORBit2 and async stuff
- From: Martin Baulig <martin home-of-linux org>
- To: Michael Meeks <michael ximian com>
- Cc: gnome-components-list gnome org
- Subject: Re: ORBit2 and async stuff
- Date: 25 May 2001 17:20:43 +0200
Martin Baulig <martin home-of-linux org> writes:
> This is the ugly part of the CORBA API which is needed due to the async
> stuff.
>
> In the C API, it's more clear:
>
> ===
> void
> gnome_selector_client_set_uri (GnomeSelectorClient *client,
> GnomeAsyncHandle **handle_return,
> const gchar *uri,
> guint timeout_msec,
> GnomeAsyncFunc async_func,
> gpointer user_data);
> ===
>
> This is an async operations (since it could, for instance, load an image over the network and then
> display it in the selector) - you'll get a `GnomeAsyncHandle *' which you can use to abort it and
> the `async_func' will be called exactly once (on succes or error).
And now I forgot to explain what I wanted to ask.
====
struct AsyncData {
ClientID client_id;
AsyncID async_id;
any user_data;
};
struct AsyncReply {
AsyncData async_data;
AsyncType type;
string uri;
boolean success;
string error;
};
void setURI (in string uri,
in AsyncData async_data);
====
The 'in AsyncData async_data' argument is basically a return value:
When the async operation is completed, the selector emits an event
in its Bonobo::EventSource and this event gets the AsyncReply struct
as argument. The client watches the event queue for "his" events by
looking at the ClientID and then it uses the AsyncID to find the
correct `GnomeAsyncHandle *' structure for the event and invoke the
C callback function.
So basically, this is method supposed to be
===
AsyncHandle setURI (in string uri);
===
However, we need to pass the AsyncData as argument rather than having
it as return value to catch a race condition - the selector may emit
the "completed" event before the setURI() CORBA call returns.
--
Martin Baulig
martin gnome org (private)
baulig suse de (work)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]