Thanks very much!

Regards
Milosz

On Wed, Apr 8, 2009 at 11:55 PM, klaus triendl <[email protected]> wrote:

> Milosz Derezynski schrieb:
>
>> Hey everyone, and especially Klaus,
>>
>> I was wondering if there is a way to have synchronous (that is, achieved
>> by proper internal locking) requests on sigx threadables?
>>
>> I have the problem that currently I have a threadable class but I need one
>> specific synchronous call that immediately returns and passes a direct
>> return value.
>>
>> I can achieve this probably by doing some manual locking and so on, but I
>> would prefer to do it with sigx directly if possible.
>>
>
> There is a way for synchronous requests: open_sync_tunnel() and
> open_sync_tunnel_with().
>
> Since there's no direct way to express synchronous requests like
> sigx::request_f<> offers for async ones you have to write your own request
> wrapper function like so:
>
> <code>
> class mythread: public sigx::threadable
> {
> protected:
>  // request handler
>  int on_calc() { return 0; }
>
> public:
>  // request api
>  int sync_calc();
> };
>
> int mythread::sync_calc()
> {
>  // sync request
>  return sigx::open_sync_tunnel(
>    sigc::mem_fun(this, &mythread::on_calc)
>  );
> }
> </code>
>
> I don't know exactly anymore why I didn't provide a sync_request_f<>
> wrapper, I guess the design rational was that it's not needed very often and
> that it's anyway better to use async requests.
>
> Regards,
> Klaus
>



-- 
Please note that according to the German law on data retention,
information on every electronic information exchange with me is
retained for a period of six months.
[Bitte beachten Sie, dass dem Gesetz zur Vorratsdatenspeicherung zufolge
jeder elektronische Kontakt mit mir sechs Monate lang gespeichert wird.]
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to