Main Page | Data Structures | File List | Globals | Related Pages

thread.h File Reference

Thread manager interface. More...

#include <list.h>
#include <task.h>
#include <register.h>
#include <timer.h>

Go to the source code of this file.

Data Structures

struct  Thread

Defines

#define THREAD_QUANTUM_INITIAL   (TIMER_HZ / 10)

Typedefs

typedef unsigned int ThreadQuantum
typedef Thread Thread

Enumerations

enum  ThreadState { THREAD_STATE_UNSCHEDULED = 0, THREAD_STATE_READY, THREAD_STATE_RUNNING, THREAD_STATE_WAITING }

Functions

int thread_manager_initialize (void)
 Initialze thread manager.

Thread * thread_current (void)
 Currently running thread.

Thread * thread_create (Task *task)
 Create a new thread.

void thread_destroy (Thread *)
 Destroy a thread.

Thread * thread_fork (Task *task)
 Fork a new thread.

void thread_exit (Thread *thread, int exitStatus)
 Exit from a thread.

Thread * thread_find (int id)
 Find a thread by id.


Detailed Description

Thread manager interface.

Provides the interface for managing threads.

Bug:
No known bugs.
Author:
Lee Salzman (lsalzman)

Function Documentation

Thread* thread_create Task *  task  ) 
 

Create a new thread.

Create a new thread in a specified task.

Parameters:
task the task to create a thread in
Returns:
the new thread on success NULL on failure

Thread* thread_current void   ) 
 

Currently running thread.

Return the currently running thread, if any.

Returns:
the running thread on success NULL on failure

void thread_destroy Thread *   ) 
 

Destroy a thread.

Free the thread's memory resources and remove it from its task.

Parameters:
thread the thread to destroy
Returns:
Void

void thread_exit Thread *  thread,
int  exitStatus
 

Exit from a thread.

Exit from a thread, setting the exit status of the task and exiting from the host task if it is the last.

Parameters:
thread the thread to exit from
exitStatus the exit status of the thread
Returns:
Void

Thread* thread_find int  id  ) 
 

Find a thread by id.

Find the thread associated with a given thread id.

Parameters:
id the id of the thread
Returns:
the found thread on success NULL on failure

Thread* thread_fork Task *  task  ) 
 

Fork a new thread.

Fork the current thread to run in a specified task.

Parameters:
task the task to fork a new thread into
Returns:
the forked thread on success NULL on failure

int thread_manager_initialize void   ) 
 

Initialze thread manager.

Initialize the thread manager's id tables.

Returns:
0 on success -1 on failure


Generated on Fri Apr 9 21:59:16 2004 for 15-410 Project 3 by doxygen 1.3.2