mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-26 23:31:55 -08:00
Minor design improvements.
Copied from Perforce Change: 194075
This commit is contained in:
parent
fe9064011c
commit
dce60f3ee6
3 changed files with 32 additions and 29 deletions
|
|
@ -135,8 +135,8 @@ Interface
|
|||
|
||||
_`.if.pthreadext.abstract`: A thread is represented by the abstract
|
||||
type ``PThreadext``. A ``PThreadext`` object corresponds directly with
|
||||
a PThread (of type ``pthread_t``). There may be more than one
|
||||
``PThreadext`` object for the same PThread.
|
||||
a thread (of type ``pthread_t``). There may be more than one
|
||||
``PThreadext`` object for the same thread.
|
||||
|
||||
_`.if.pthreadext.structure`: The structure definition of
|
||||
``PThreadext`` (``PThreadextStruct``) is exposed by the interface so
|
||||
|
|
@ -163,16 +163,16 @@ _`.if.suspend`: Suspends a ``PThreadext`` object (puts it into a
|
|||
suspended state). Meets `.req.suspend`_. The object must not already
|
||||
be in a suspended state. If the function returns ``ResOK``, the
|
||||
context of the thread is returned in contextReturn, and the
|
||||
corresponding PThread will not make any progress until it is resumed:
|
||||
corresponding thread will not make any progress until it is resumed.
|
||||
|
||||
``Res PThreadextResume(PThreadext pthreadext)``
|
||||
|
||||
_`.if.resume`: Resumes a ``PThreadext`` object. Meets
|
||||
`.req.resume`_. The object must already be in a suspended state.
|
||||
Puts the object into a non-suspended state. Permits the corresponding
|
||||
PThread to make progress again, (although that might not happen
|
||||
immediately if there is another suspended ``PThreadext`` object
|
||||
corresponding to the same thread):
|
||||
_`.if.resume`: Resumes a ``PThreadext`` object. Meets `.req.resume`_.
|
||||
The object must already be in a suspended state. Puts the object into
|
||||
a non-suspended state. Permits the corresponding thread to make
|
||||
progress again, although that might not happen immediately if there is
|
||||
another suspended ``PThreadext`` object corresponding to the same
|
||||
thread.
|
||||
|
||||
``void PThreadextFinish(PThreadext pthreadext)``
|
||||
|
||||
|
|
@ -189,9 +189,9 @@ _`.impl.pthreadext`: The structure definition for a ``PThreadext``
|
|||
object is::
|
||||
|
||||
struct PThreadextStruct {
|
||||
Sig sig; /* design.mps.sig */
|
||||
Sig sig; /* <design/sig/> */
|
||||
pthread_t id; /* Thread ID */
|
||||
struct sigcontext *suspendedScp; /* sigcontext if suspended */
|
||||
MutatorContext context; /* context if suspended */
|
||||
RingStruct threadRing; /* ring of suspended threads */
|
||||
RingStruct idRing; /* duplicate suspensions for id */
|
||||
};
|
||||
|
|
@ -199,7 +199,7 @@ object is::
|
|||
_`.impl.field.id`: The ``id`` field shows which PThread the object
|
||||
corresponds to.
|
||||
|
||||
_`.impl.field.scp`: The ``suspendedScp`` field contains the context
|
||||
_`.impl.field.context`: The ``context`` field contains the context
|
||||
when in a suspended state. Otherwise it is ``NULL``.
|
||||
|
||||
_`.impl.field.threadring`: The ``threadRing`` field is used to chain
|
||||
|
|
@ -208,29 +208,30 @@ the object onto the suspend ring when it is in the suspended state
|
|||
this ring is single.
|
||||
|
||||
_`.impl.field.idring`: The ``idRing`` field is used to group the
|
||||
object with other objects corresponding to the same PThread (same
|
||||
object with other objects corresponding to the same thread (same
|
||||
``id`` field) when they are in the suspended state. When not in a
|
||||
suspended state, or when this is the only ``PThreadext`` object with
|
||||
this ``id`` in the suspended state, this ring is single.
|
||||
|
||||
_`.impl.global.suspend-ring`: The module maintains a global
|
||||
suspend-ring -- a ring of ``PThreadext`` objects which are in a
|
||||
_`.impl.global.suspend-ring`: The module maintains a global varaible
|
||||
``suspendedRing``, a ring of ``PThreadext`` objects which are in a
|
||||
suspended state. This is primarily so that it's possible to determine
|
||||
whether a thread is curently suspended anyway because of another
|
||||
``PThreadext`` object, when a suspend attempt is made.
|
||||
|
||||
_`.impl.global.victim`: The module maintains a global variable which
|
||||
is used to indicate which ``PThreadext`` is the current victim during
|
||||
suspend operations. This is used to communicate information between
|
||||
the controlling thread and the thread being suspended (the victim).
|
||||
The variable has value ``NULL`` at other times.
|
||||
_`.impl.global.victim`: The module maintains a global variable
|
||||
``suspendingVictim`` which is used to indicate which ``PThreadext`` is
|
||||
the current victim during suspend operations. This is used to
|
||||
communicate information between the controlling thread and the thread
|
||||
being suspended (the victim). The variable has value ``NULL`` at other
|
||||
times.
|
||||
|
||||
_`.impl.static.mutex`: We use a lock (mutex) around the suspend and
|
||||
resume operations. This protects the state data (the suspend-ring the
|
||||
victim: see `.impl.global.suspend-ring`_ and `.impl.global.victim`_
|
||||
respectively). Since only one thread can be suspended at a time,
|
||||
there's no possibility of two arenas suspending each other by
|
||||
concurrently suspending each other's threads.
|
||||
resume operations. This protects the state data (the suspend-ring and
|
||||
the victim: see `.impl.global.suspend-ring`_ and
|
||||
`.impl.global.victim`_ respectively). Since only one thread can be
|
||||
suspended at a time, there's no possibility of two arenas suspending
|
||||
each other by concurrently suspending each other's threads.
|
||||
|
||||
_`.impl.static.semaphore`: We use a semaphore to synchronize between
|
||||
the controlling and victim threads during the suspend operation. See
|
||||
|
|
@ -375,7 +376,7 @@ Document History
|
|||
Copyright and License
|
||||
---------------------
|
||||
|
||||
Copyright © 2013-2016 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
Copyright © 2013-2018 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
All rights reserved. This is an open source license. Contact
|
||||
Ravenbrook for commercial licensing options.
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ guarantee behaviour in this case. For example, POSIX_ says, "A
|
|||
conforming implementation is free to reuse a thread ID after its
|
||||
lifetime has ended. If an application attempts to use a thread ID
|
||||
whose lifetime has ended, the behavior is undefined." For this reason,
|
||||
the documentation for ``mps_thread_dereg()`` specifies that it is an
|
||||
the documentation for ``mps_thread_reg()`` specifies that it is an
|
||||
error if a thread dies while registered.
|
||||
|
||||
.. _POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_02
|
||||
|
|
|
|||
|
|
@ -563,7 +563,9 @@ represented in the obvious way::
|
|||
|
||||
member(ti, ts) ⇔ ((1<<ti) & ts) != 0
|
||||
|
||||
``TraceSet`` is used to represent colour in the Tracer. See
|
||||
In the multiple-traces design, each region of memory may be a
|
||||
different colour for each trace. Thus the set of traces for which a
|
||||
segment is grey (say) is represented by a ``TraceSet``. See
|
||||
design.mps.trace_.
|
||||
|
||||
.. _design.mps.trace: trace
|
||||
|
|
@ -694,7 +696,7 @@ Document History
|
|||
Copyright and License
|
||||
---------------------
|
||||
|
||||
Copyright © 2013-2017 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
Copyright © 2013-2018 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
All rights reserved. This is an open source license. Contact
|
||||
Ravenbrook for commercial licensing options.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue