mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 23:14:49 +02:00
D front-end changes: - Import dmd v2.113.0-beta.1. - Add support for static array length inference. - Added trait `__traits(needsDestruction, T)'. - Added trait `__traits(isOverlapped, field)'. D runtime changes: - Import druntime v2.113.0-beta.1. Phobos changes: - Import phobos v2.113.0-beta.1. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 55e64690bc. * dmd/VERSION: Bump version to v2.113.0-beta.1. * d-codegen.cc (d_build_call): Check if argument is already a TARGET_EXPR. * decl.cc (DeclVisitor::visit (FuncDeclaration *)): Don't use `__result' decl as named return value if it's a ref type. * expr.cc (ExprVisitor::visit (StructLiteralExp *)): Force TARGET_EXPR if init symbol needs to be mutable. * runtime.def (ARRAYSETLENGTHT): Remove. (ARRAYSETLENGTHIT): Remove. (ARRAYCOPY): Remove. (ARRAYAPPENDCTX): Remove. * typeinfo.cc (TypeInfoVisitor::visit (TypeInfoClassDeclaration *)): Only scan class fields for pointer members. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 55e64690bc. * src/MERGE: Merge upstream phobos 0c519ae39. * src/Makefile.am (PHOBOS_DSOURCES): Add std/internal/windows/bcrypt.d. * src/Makefile.in: Regenerate. * testsuite/libphobos.aa/test_aa.d: Update. * testsuite/libphobos.phobos/std_array.d: Regenerate. * testsuite/libphobos.phobos/std_mathspecial.d: Regenerate. * src/std/internal/windows/bcrypt.d: New file.
58 lines
1.3 KiB
D
58 lines
1.3 KiB
D
/**
|
|
* 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);
|
|
}
|