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

id.c File Reference

Implemention of the IDTable tasks. More...

#include <id.h>
#include <malloc.h>
#include <string.h>
#include <stdlib.h>

Functions

int id_table_create (IdTable *table, unsigned int size)
 Creates an id table.

void id_table_destroy (IdTable *table)
 Destroys an id table.

IdEntry * id_table_find_entry (IdTable *table, int hash, int key)
void * id_table_find (IdTable *table, int id)
 Find an id in the table.

void * id_table_remove (IdTable *table, int id)
 Remove an id from the table.

int id_table_insert (IdTable *table, void *data)
 Allocate an id.


Detailed Description

Implemention of the IDTable tasks.

This file provides the implementation for the ID tables for threads

Author:
Lee Salzman (lsalzman)

Hassaan Moin Khan (hkhan)

Bug:
No known bugs.

Function Documentation

int id_table_create IdTable *  table,
unsigned int  size
 

Creates an id table.

Creates a new id table of the specified size.

Parameters:
table the location of the table
size the starting size of tha table
Returns:
0 on success -1 on failure

void id_table_destroy IdTable *  table  ) 
 

Destroys an id table.

Frees any memory used by the id table.

Parameters:
table the table to destroy
Returns:
Void

void* id_table_find IdTable *  table,
int  id
 

Find an id in the table.

Returns the data associated with a thread id.

Parameters:
table the table to find in
id the id to find
Returns:
the data associated with the id on success NULL on failure

int id_table_insert IdTable *  table,
void *  data
 

Allocate an id.

Insert a thread into the id table with a new id.

Parameters:
table the table to insert into
data the thread data
Returns:
the allocated id on success -1 on failure

void* id_table_remove IdTable *  table,
int  id
 

Remove an id from the table.

Removes an id from the table.

Parameters:
table the table to remove from
id the id to remove
Returns:
the data that was at the entry if present NULL if not present


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