mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 14:59:39 +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.
67 lines
1.5 KiB
D
67 lines
1.5 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/context.d)
|
|
*/
|
|
|
|
module core.thread.context;
|
|
|
|
///
|
|
struct StackContext
|
|
{
|
|
void* bstack, tstack;
|
|
|
|
/// Slot for the EH implementation to keep some state for each stack
|
|
/// (will be necessary for exception chaining, etc.). Opaque as far as
|
|
/// we are concerned here.
|
|
void* ehContext;
|
|
StackContext* within;
|
|
StackContext* next, prev;
|
|
}
|
|
|
|
struct Callable
|
|
{
|
|
void opAssign(void function() fn) pure nothrow @nogc @safe
|
|
{
|
|
() @trusted { m_fn = fn; }();
|
|
m_type = Call.FN;
|
|
}
|
|
void opAssign(void delegate() dg) pure nothrow @nogc @safe
|
|
{
|
|
() @trusted { m_dg = dg; }();
|
|
m_type = Call.DG;
|
|
}
|
|
void opCall()
|
|
{
|
|
switch (m_type)
|
|
{
|
|
case Call.FN:
|
|
m_fn();
|
|
break;
|
|
case Call.DG:
|
|
m_dg();
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
private:
|
|
enum Call
|
|
{
|
|
NO,
|
|
FN,
|
|
DG
|
|
}
|
|
Call m_type = Call.NO;
|
|
union
|
|
{
|
|
void function() m_fn;
|
|
void delegate() m_dg;
|
|
}
|
|
}
|