Re: [gtkmm] Using a despatcher to provide thread safe signals with parameters
- From: Maurizio Umberto Puxeddu <mauriziopuxeddu yahoo it>
- To: Dan Alderman <d alderman 180sw com>
- Cc: gtkmm-list gnome org
- Subject: Re: [gtkmm] Using a despatcher to provide thread safe signals with parameters
- Date: 22 Apr 2003 22:32:18 +0200
I think you can push data in a dedicated queue in a thread an pop it in
the dispatcher's callback. Depending on the data structure used, you may
need to protect the queue with a Mutex while you are pushing/poping
objects (it could be simply be a std::list<YourMessage *> instead of a
lock free fifo).
Maurizio Umberto Puxeddu.
On Tue, 2003-04-22 at 18:02, Dan Alderman wrote:
> Hi,
>
> Can someone here please help me, I think I'm about to go mad.
>
> I have been looking at the examples provided within the gtkmm/sigc++ et
> al documentation but am still very confused.
>
> I have 3 distinct parts to a simple system, a GUI (view), some data (a
> model) and a "MegaManipulator" to manipulate the data (controller). I
> have been using normal signals to notify a drawing area that the
> underlying data that it uses to draw itself has changed. The underlying
> data is changed by the MegaManipulator in a separate thread created in
> main(). As I am now aware I cannot use normal signals when using
> threads and I need to use a Glib::Dispatcher. Unfortunately this poses
> a problem for me. The signal that I have been using sends 2 vital
> pieces of information, the location of the change and it's value (this
> saves redrawing the entire area which is a hex display of a byte
> array). If I am to use a dispatcher I can no longer send this
> information because it is effectively a Slot0 type signal and not a
> Slot2 which is what I need.
>
> The SigC::bind method looked like it did what I wanted but it appears I
> can only bind static data and not variables.
>
> Can someone here provide some insight or examples showing me how I can
> achieve this? I have looked at dispatcher.cc example which uses a
> Glib::Dispatcher but this doesn't provide any example on how to ship the
> data in a signal.
>
> Thanks for your help,
>
> Dan.
> --
> =====================================================================
> Dan Alderman Software Engineer
>
> OneEighty Software Ltd. Phone: +44 20 8680 8712
> Cygnet House Fax: +44 20 8680 8453
> 12-14 Sydenham Road
> Croydon Email: d alderman 180sw com
> CR9 2ET
> UK
>
> Under the Regulation of Investigatory Powers (RIP) Act 2000 together
> with any and all Regulations in force pursuant to the Act One Eighty
> Software Ltd reserves the right to monitor any or all incoming or
> outgoing communications as provided for under the Act.
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]