diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-01-28 11:18:42 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-01-30 16:50:57 +0100 |
commit | 92dd3e71f957c7818f4ce4189bd187b59af20d9b (patch) | |
tree | b5f4cae41be41fe6716dc656649ca8c35b96d8c0 /libphobos/libdruntime/rt/monitor_.d | |
parent | accc5ba53e0d0c660aa69f16ef32fc05e4439f1f (diff) | |
download | gcc-92dd3e71f957c7818f4ce4189bd187b59af20d9b.zip gcc-92dd3e71f957c7818f4ce4189bd187b59af20d9b.tar.gz gcc-92dd3e71f957c7818f4ce4189bd187b59af20d9b.tar.bz2 |
libphobos: Synchronize libdruntime bindings with upstream druntime
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.
Diffstat (limited to 'libphobos/libdruntime/rt/monitor_.d')
-rw-r--r-- | libphobos/libdruntime/rt/monitor_.d | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/libphobos/libdruntime/rt/monitor_.d b/libphobos/libdruntime/rt/monitor_.d index e38b015..8cb3c3a 100644 --- a/libphobos/libdruntime/rt/monitor_.d +++ b/libphobos/libdruntime/rt/monitor_.d @@ -28,15 +28,11 @@ in body { auto m = ensureMonitor(cast(Object) owner); - auto i = m.impl; - if (i is null) + if (m.impl is null) { atomicOp!("+=")(m.refs, cast(size_t) 1); - ownee.__monitor = owner.__monitor; - return; } - // If m.impl is set (ie. if this is a user-created monitor), assume - // the monitor is garbage collected and simply copy the reference. + // Assume the monitor is garbage collected and simply copy the reference. ownee.__monitor = owner.__monitor; } @@ -60,6 +56,26 @@ extern (C) void _d_monitordelete(Object h, bool det) } } +// does not call dispose events, for internal use only +extern (C) void _d_monitordelete_nogc(Object h) @nogc +{ + auto m = getMonitor(h); + if (m is null) + return; + + if (m.impl) + { + // let the GC collect the monitor + setMonitor(h, null); + } + else if (!atomicOp!("-=")(m.refs, cast(size_t) 1)) + { + // refcount == 0 means unshared => no synchronization required + deleteMonitor(cast(Monitor*) m); + setMonitor(h, null); + } +} + extern (C) void _d_monitorenter(Object h) in { |