digitalmars.D.learn - Multiple signals using std.signal
- Mandeep Singh Brar (7/7) Jan 22 2011 Hi,
- Christopher Nicholson-Sauls (10/20) Jan 22 2011 Use mixin naming to provide multiple signals, like so:
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
Jan 22 2011
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 MandeepUse 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
Jan 22 2011