mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-11-25 17:28:41 +08:00
92dd3e71f9
Reviewed-on: https://github.com/dlang/druntime/pull/3348 gcc/d/ChangeLog: * typeinfo.cc (TypeInfoVisitor::visit (TypeInfoDeclaration *)): Don't layout m_arg1 and m_arg2 fields. libphobos/ChangeLog: * Makefile.in: Regenerate. * configure: Regenerate. * libdruntime/MERGE: Merge upstream druntime e4aae28e. * libdruntime/Makefile.am (DRUNTIME_DSOURCES): Refresh module list. (DRUNTIME_DSOURCES_BIONIC): Add core/sys/bionic/err.d. (DRUNTIME_DSOURCES_DARWIN): Add core/sys/darwin/err.d, core/sys/darwin/ifaddrs.d, core/sys/darwin/mach/nlist.d, core/sys/darwin/mach/stab.d, and core/sys/darwin/sys/attr.d. (DRUNTIME_DSOURCES_DRAGONFLYBSD): Add core/sys/dragonflybsd/err.d. (DRUNTIME_DSOURCES_FREEBSD): Add core/sys/freebsd/err.d. (DRUNTIME_DSOURCES_LINUX): Add core/sys/linux/err.d. (DRUNTIME_DSOURCES_NETBSD): Add core/sys/netbsd/err.d. (DRUNTIME_DSOURCES_OPENBSD): Add core/sys/openbsd/err.d. (DRUNTIME_DSOURCES_POSIX): Add core/sys/posix/locale.d, core/sys/posix/stdc/time.d, core/sys/posix/string.d, and core/sys/posix/strings.d. (DRUNTIME_DSOURCES_SOLARIS): Add core/sys/solaris/err.d. (DRUNTIME_DSOURCES_WINDOWS): Add core/sys/windows/sdkddkver.d, and core/sys/windows/stdc/time.d * libdruntime/Makefile.in: Regenerate. * libdruntime/gcc/sections/elf_shared.d (sizeofTLS): New function. * testsuite/libphobos.thread/fiber_guard_page.d: Use __traits(getMember) to get internal fields.
66 lines
1.5 KiB
D
66 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/package.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;
|
|
}
|
|
}
|