Signal and slot trouble

Peter Federighi pfederighi at yahoo.com
Sun Nov 21 10:34:43 PST 2010


>From div0:
This is just a random stab in the dark, but my guess is that std.signals
hasn't been updated since the changes that make global vars live in TLS.

Try

__gshared SignalForwarder sigWinchSignal;
__gshared SignalForwarder sigAlrmSignal;


>From Johannes Pfau:
SigWinchHandler is a class, so you have to create instances of the class
with new. In your main function "SigWinchHandler winch;" just sets winch
to null and in the connect call you access winch.handler which causes the
crash. What you need to do is "SigWinchHandler winch = new
SigWinchHandler();" and the same for SigAlrmHandler.



I've tried both of these things and neither work, nor do they work together.  Is
it because I'm trying to declare global instances of a class and then connect
things to it?  Does D make the object static or something?  I've tried the example
from the Digital Mars website and it works, but nothing in it was declared global.

Is there another (hopefully better) solution for catching C style signals in D?
Is there another way to program a timer and find out if the terminal size has
changed without having to use polling?

Thank you for your help,
- Peter


More information about the Digitalmars-d-learn mailing list