Unable to set static data member of a class (results in default value 0)

Enjoys Math via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 27 15:21:11 PDT 2017



I have:

class DataSignal : Thread
{
public:
    static int dataReadDelay;

    void run() {
        while (true) {
            Thread.sleep(dur!"msecs"(dataReadDelay));
            // Read in the new file data
        }
    }
}


in main I have:

DataSignal.dataReadDelay = 8000;

// initialize a bunch of signals


Then when each thread is running they sleep for 0 seconds, and I 
can verify that dataReadDelay is staying at 0.  I have 
initialized it no where else.  This seems like a major bug.


More information about the Digitalmars-d-learn mailing list