Wolfgang Thallergcc16 merge934c3885 months agoHistory
57 lines · 1.3 KB · D
RawDownload
/** * The thread module provides support for thread creation and management. * * Copyright: Copyright Sean Kelly 2005 - 2012. * License: Distributed under the *      $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0). *    (See accompanying file LICENSE) * Authors:   Sean Kelly, Walter Bright, Alex Rønne Petersen, Martin Nowak * Source:    $(DRUNTIMESRC core/thread/package.d) */ module core.thread; public import core.time;public import core.thread.fiber;public import core.thread.osthread;public import core.thread.threadbase;public import core.thread.threadgroup;public import core.thread.types;public import core.thread.context;  // this test is here to avoid a cyclic dependency between// core.thread and core.atomic@system unittest{    import core.atomic;     shared uint x;    shared bool f;    shared uint r;     auto thr = new Thread(()    {        while (!atomicLoad(f))        {        }         atomicFence(); // make sure load+store below happens after waiting for f         cast() r = cast() x;    });     thr.start(); // new thread will wait until f is set     cast() x = 42;     atomicFence(); // make sure x is set before setting f     cast() f = true;     atomicFence();     thr.join();     assert(cast() r == 42);}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t