[D-runtime] [D-Programming-Language/druntime] b78aaa: core.thread: Implement critical regions.
GitHub
noreply at github.com
Sun Jul 8 18:36:49 PDT 2012
Branch: refs/heads/master
Home: https://github.com/D-Programming-Language/druntime
Commit: b78aaa336de470cc723ac23b09a29bf68e822d1f
https://github.com/D-Programming-Language/druntime/commit/b78aaa336de470cc723ac23b09a29bf68e822d1f
Author: alexrp <xtzgzorex at gmail.com>
Date: 2012-07-06 (Fri, 06 Jul 2012)
Changed paths:
M import/core/thread.di
M src/core/thread.d
Log Message:
-----------
core.thread: Implement critical regions.
(Not to be confused with critical sections.)
Critical regions are areas of code where a thread absolutely must
not be suspended. Entering and exiting a critical region is very
similar to acquiring and releasing a mutex, but critical regions
do not block. They simply ensure that when the world is stopped,
a thread will not be suspended inside critical code; i.e. it will
be continually suspended and resumed until it is no longer in a
critical region.
This feature is useful to maintain invariants in garbage collectors
where you would normally use a lock. Empirically, it only happens
very rarely that a thread is suspended inside a critical region, so
the suspend/resume loop is a cheaper approach than always locking,
since locking results in high contention.
The way this commit implements critical regions, they are useful
beyond garbage collection, however; they are not specifically
coupled to any GC code.
Using critical regions is extremely error-prone. For instance,
using a lock inside a critical region will most likely result in
an application deadlocking because the stop-the-world routine will
attempt to suspend and resume the thread forever, to no avail. This
means that you really shouldn't be messing with this feature unless
you *really* do know what you're doing.
Commit: cf02a4327313a347a49a5f5fa46eb63e01946dd4
https://github.com/D-Programming-Language/druntime/commit/cf02a4327313a347a49a5f5fa46eb63e01946dd4
Author: alexrp <xtzgzorex at gmail.com>
Date: 2012-07-06 (Fri, 06 Jul 2012)
Changed paths:
M import/core/thread.di
M src/core/thread.d
Log Message:
-----------
Document that critical regions are error-prone.
Commit: 7cc048adce5e495edb2b6a109385be6ada8cda68
https://github.com/D-Programming-Language/druntime/commit/7cc048adce5e495edb2b6a109385be6ada8cda68
Author: alexrp <alex at lycus.org>
Date: 2012-07-08 (Sun, 08 Jul 2012)
Changed paths:
M src/core/thread.d
Log Message:
-----------
Kill unnecessary docs in thread.d.
Commit: 8f8bc9b98d37a2e7f259f56b067048a479c1440e
https://github.com/D-Programming-Language/druntime/commit/8f8bc9b98d37a2e7f259f56b067048a479c1440e
Author: alexrp <alex at lycus.org>
Date: 2012-07-08 (Sun, 08 Jul 2012)
Changed paths:
M import/core/thread.di
Log Message:
-----------
Add reference to Mono's critical regions.
Commit: 49b453e5cb1baa968b63d23ce107950ba93a34b1
https://github.com/D-Programming-Language/druntime/commit/49b453e5cb1baa968b63d23ce107950ba93a34b1
Author: alexrp <alex at lycus.org>
Date: 2012-07-08 (Sun, 08 Jul 2012)
Changed paths:
M import/core/thread.di
Log Message:
-----------
Make critical region functions undocumented for now.
Commit: 1da26de4c5b74edb055e263fec3cca0d89551fcd
https://github.com/D-Programming-Language/druntime/commit/1da26de4c5b74edb055e263fec3cca0d89551fcd
Author: Andrei Alexandrescu <andrei at erdani.com>
Date: 2012-07-08 (Sun, 08 Jul 2012)
Changed paths:
M import/core/thread.di
M src/core/thread.d
Log Message:
-----------
Merge pull request #204 from alexrp/thread-critical-regions
core.thread: Implement critical regions.
Compare: https://github.com/D-Programming-Language/druntime/compare/fcab51193a98...1da26de4c5b7
More information about the D-runtime
mailing list