On Monday, 8 August 2022 at 01:36:45 UTC, vc wrote:
Hello, i have the following code, the flora contains a boolean zeus in the DerivedThread the boolean zeus was set to true; but when i'm trying to access it
outside the thread in main it returns me false; any thoughts ?

import flora;

class DerivedThread : Thread
{
    this()
    {
        super(&run);
    }

private:
    void run()
    {
        // Derived thread running.
        zeus = true;

        while(true)
        {

        }

    }
}




void main()
{

    auto derived = new DerivedThread().start();

    writeln(zeus);

}

When `writeln(zeus)` runs, `zeus = true` probably was not evaluated yet.

Reply via email to