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

thread.c File Reference

Implementaion for threads. More...

#include <id.h>
#include <thread.h>
#include <register.h>
#include <scheduler.h>
#include <x86/proc_reg.h>
#include <x86/seg.h>
#include <malloc.h>
#include <string.h>

Functions

int thread_manager_initialize (void)
 Initialze thread manager.

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

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

void thread_destroy (Thread *thread)
 Destroy a thread.

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

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


Variables

IdTable threadTable


Detailed Description

Implementaion for threads.

This file provides the implementation for threads

Author:
Lee Salzman (lsalzman)

Hassaan Moin Khan (hkhan)

Bug:
No known bugs.

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

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