Why can't information be passed using the Dispatcher?


`Glib::Dispatcher` has syntax similar to a void signal, but there are cases where it would be convenient to pass information between threads using the same syntax. Obviously returning anything would be impossible, but is there a technical reason not to have one way communication (e.g. `Glib::Dispatcher<int>` that can be used a little like a `sigc::signal<void(int)>`)? Obviously the user would have to be especially careful about scope (don't pass references to things that might be deleted before the other thread can act on the signal). In some cases it might also make sense to pass a mutex alongside the value.

Is this functionality not provided as part of libsigc++ just because it's unsafe-by-default, or is there a deeper problem? According to this old thread, libsigcX provides something similar, but it looks like it hasn't been updated in a very long time.

If there's not an obvious issue that makes it impossible, I'll probably write myself a wrapper class that gives me this kind of behavior.



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