mirror of
https://github.com/openRuyi-Project/gcc.git
synced 2026-06-14 15:35:53 +00:00
3b007164b3
D front-end changes: - Import dmd v2.104.0-beta.1. - Better error message when attribute inference fails down the call stack. - Using `;' as an empty statement has been turned into an error. - Using `in' parameters with non- `extern(D)' or `extern(C++)' functions is deprecated. - `in ref' on parameters has been deprecated in favor of `-preview=in'. - Throwing `immutable', `const', `inout', and `shared' qualified objects is now deprecated. - User Defined Attributes now parse Template Arguments. D runtime changes: - Import druntime v2.104.0-beta.1. Phobos changes: - Import phobos v2.104.0-beta.1. - Better static assert messages when instantiating `std.algorithm.comparison.clamp' with wrong inputs. - `std.typecons.Rebindable' now supports all types. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 28a3b24c2e. * dmd/VERSION: Bump version to v2.104.0-beta.1. * d-codegen.cc (build_bounds_slice_condition): Update for new front-end interface. * d-lang.cc (d_init_options): Likewise. (d_handle_option): Likewise. (d_post_options): Initialize global.compileEnv. * expr.cc (ExprVisitor::visit (CatExp *)): Replace code generation with new front-end lowering. (ExprVisitor::visit (LoweredAssignExp *)): New method. (ExprVisitor::visit (StructLiteralExp *)): Don't generate static initializer symbols for structs defined in C sources. * runtime.def (ARRAYCATT): Remove. (ARRAYCATNTX): Remove. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 28a3b24c2e. * src/MERGE: Merge upstream phobos 8ab95ded5. gcc/testsuite/ChangeLog: * gdc.dg/rtti1.d: Move array concat testcase to ... * gdc.dg/nogc1.d: ... here. New test.
60 lines
1.2 KiB
D
60 lines
1.2 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
|
|
unittest
|
|
{
|
|
import core.atomic;
|
|
|
|
// Use heap memory to ensure an optimizing
|
|
// compiler doesn't put things in registers.
|
|
uint* x = new uint();
|
|
bool* f = new bool();
|
|
uint* r = new uint();
|
|
|
|
auto thr = new Thread(()
|
|
{
|
|
while (!*f)
|
|
{
|
|
}
|
|
|
|
atomicFence();
|
|
|
|
*r = *x;
|
|
});
|
|
|
|
thr.start();
|
|
|
|
*x = 42;
|
|
|
|
atomicFence();
|
|
|
|
*f = true;
|
|
|
|
atomicFence();
|
|
|
|
thr.join();
|
|
|
|
assert(*r == 42);
|
|
}
|