January 22, 2011 Multiple signals using std.signal | ||||
---|---|---|---|---|
| ||||
Hi, Is it possible for a class to emit multiple types of signals using std.signal. e.g. SignalA, SignalB etc. Also i believe that emit method emits signals synchronously. Is it possible to emit method asynchronously. Thanks Mandeep |
January 22, 2011 Re: Multiple signals using std.signal | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mandeep Singh Brar | On 01/22/11 12:45, Mandeep Singh Brar wrote:
> Hi,
>
> Is it possible for a class to emit multiple types of signals using std.signal. e.g. SignalA, SignalB etc.
>
> Also i believe that emit method emits signals synchronously. Is it possible to emit method asynchronously.
>
> Thanks
> Mandeep
Use mixin naming to provide multiple signals, like so:
class Foo {
mixin Signal!(int, int) signalA;
mixin Signal!(int, string) signalB;
}
Emit with signalA.emit(), connect with signalA.connect(), etc. For the latter question: I don't think so without redesigning the std.signals module, which is probably worth filing an enhancement request for.
-- Chris N-S
|
Copyright © 1999-2021 by the D Language Foundation