add

Aswin Parthasarathy

Thread routines.

MyThread MyThreadCreate (void(*start_funct)(void *), void *args)
    This routine creates a new MyThread. The parameter start_func is the function in which the new thread starts executing. The parameter args is passed to the start function. This routine does not pre-empt the invoking thread. In others words the parent (invoking) thread will continue to run; the child thread will sit in the ready queue. 
void MyThreadYield(void)
    Suspend execution of invoking thread and yield to another thread. The invoking thread remains ready to executeit is not blocked. Thus, if there is no other ready thread, the invoking thread will continue to execute. 
int MyThreadJoin(MyThread thread)
    Join the invoking function with the specified child thread. If child has already terminated, do not block. Note: A child may have terminated without the parent having joined with it. Returns 0 on success (after any necessary blocking). It returns -1 on failure. Failure occurs if specified thread is not an immediate child of invoking thread. 
void MyThreadJoinAll(void)
    Waits until all children have terminated. Returns immediately if there are no active children. 
void MyThreadExit(void)
    Terminates the invoking thread. Note: all MyThreads are required to invoked this function. Do not allow functions to fall out of the start function.

Semaphore routines.

MySemaphore MySemaphoreInit(int initialValue)
    Create a semaphore. Set the initial value to initialValue, which must be non-negative. A positive initial value has the same effect as invoking MySemaphoreSignal the same number of times. 
void MySemaphoreSignal(MySemaphore sem)
    Signal semaphore sem. The invoking thread is not pre-empted. 
void MySemaphoreWait(MySemaphore sem)
    Wait on semaphore sem. 
int MySemaphoreDestroy(MySemaphore sem)
    Destroy semaphore sem. Do not destroy semaphore if any threads are blocked on the queue. Return 0 on success, -1 on failure.

Unix process routines

void MyThreadInit (void(*start_funct)(void *), void *args)
    This routine is called before any other MyThread call. Invoked only by the Unix process. It is similar to MyThreadCreate. The MyThread created is the oldest ancestor of all MyThreads—it is the “main” MyThread. This routine can only be invoked once. 
void MyThreadRun(void)
    This is similar to a MyThreadJoinAll, but can only be invoked by the Unix process. This routine can only be invoked once.