Skip to content

Commit

Permalink
Added text on mainResume and Exit
Browse files Browse the repository at this point in the history
  • Loading branch information
nmcl committed Dec 23, 2016
1 parent 707c63f commit ec0ed46
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Documents/manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ Current_Thread must be defined by the derived class as it returns the identity o

The implementations of the operations Identity and Self are provided by the base class because some threads packages do not provide similar functionality: Identity returns the unique identity of the thread associated with the given objects, and Self returns the currently executing thread. Because Self is a _static_ member function it can be invoked without creating an instance of the Thread class, i.e., using Thread::Self().

Typically when building your simulation you will have a single process which coordinates the other entities. This coordinator will be its own simulation entity that is created by the main (process) thread, which itself must be suspended while the simulation executes. This means that when the simulation wants to end, the main thread must be resumed. The mainResume() method should be called by your coordinator entity to have this happen.

If during the execution of your simulation you ever need to exit the entire process, use the exit() method and you can pass a specific return code.

=== Specific Thread Class Implementations

Over the years we have supported a wide variety of thread packages, ranging from those available in various Unix implementations such as Solaris, through Posix compliant thread packages and to Windows threads. However, currently we can only test on Linux so that is the only implementation we support.
Expand Down
16 changes: 15 additions & 1 deletion Manual/man/man3/Thread.3A
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@ Thread \- runtime thread implementation
.br
.BI " virtual void Resume ();"
.br
.BI " virtual void Body ();"
.BI " virtual void Body () = 0;"
.sp
.BI " virtual long Current_Thread () const;"
.sp
.BI " virtual long Identity () const;"
.sp
.BI " static Thread *Self ();"
.sp
.BI " statid void Exit (int = 0);
.sp
.BI " static void mainResume ();"
.sp
.BI "protected:"
.br
.BI " Thread ();"
Expand Down Expand Up @@ -70,6 +74,16 @@ to.
Self
returns a pointer to the currently active thread object.

Typically when building your simulation you will have a single process which coordinates the other entities. This coordinator will be its own simulation entity that is created by the main (process) thread, which itself must be suspended while the simulation executes. This means that when the simulation wants to end, the main thread must be resumed. The
.B
mainResume
method should be called by your coordinator entity to have this happen.

If during the execution of your simulation you ever need to exit the entire process, use the
.B
exit
method and you can pass a specific return code.

.B
thread_key
is used to uniquely identify each threaded object within
Expand Down

0 comments on commit ec0ed46

Please sign in to comment.