From: Godmar Back Date: Fri, 17 Oct 2008 03:26:23 +0000 (+0000) Subject: added documentation for thread_foreach functions X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c882acea92ccb02854a88b7db1810a905e22bf66;p=pintos-anon added documentation for thread_foreach functions --- diff --git a/doc/debug.texi b/doc/debug.texi index aa833ac..402ede6 100644 --- a/doc/debug.texi +++ b/doc/debug.texi @@ -99,6 +99,8 @@ of how your program got where it is, as a list of addresses inside the functions that were running at the time of the panic. You can also insert a call to @func{debug_backtrace}, prototyped in @file{}, to print a backtrace at any point in your code. +@func{debug_backtrace_all}, also declared in @file{}, +prints backtraces of all threads. The addresses in a backtrace are listed as raw hexadecimal numbers, which are difficult to interpret. We provide a tool called diff --git a/doc/reference.texi b/doc/reference.texi index bcdcd63..924fd78 100644 --- a/doc/reference.texi +++ b/doc/reference.texi @@ -325,6 +325,13 @@ Pintos as provided ignores thread priorities, but you will implement priority scheduling in project 1 (@pxref{Priority Scheduling}). @end deftypecv +@deftypecv {Member} {@struct{thread}} {@struct{list_elem}} allelem +This ``list element'' is used to link the thread into the list of all +threads. Each thread is inserted into this list when it is created +and removed when it exits. The @func{thread_foreach} function should +be used to iterate over all threads. +@end deftypecv + @deftypecv {Member} {@struct{thread}} {@struct{list_elem}} elem A ``list element'' used to put the thread into doubly linked lists, either @code{ready_list} (the list of threads ready to run) or a list of @@ -446,6 +453,16 @@ function to keep this thread from running for any particular length of time. @end deftypefun +@deftypefun void thread_foreach (thread_action_func *@var{action}, void *@var{aux}) +Iterates over all threads @var{t} and invokes @code{action(t, aux)} on each. +@var{action} must refer to a function that matches the signature +given by @func{thread_action_func}: + +@deftp {Type} {void thread_action_func (struct thread *@var{thread}, void *@var{aux})} +Performs some action on a thread, given @var{aux}. +@end deftp +@end deftypefun + @deftypefun int thread_get_priority (void) @deftypefunx void thread_set_priority (int @var{new_priority}) Stub to set and get thread priority. @xref{Priority Scheduling}.