14

SUN/266.1

Starlink Project
Starlink User Note 266.1

D.S. Berry

12th September 2011


THR
A Thread Management Library

Version 1.0

Programmer’s Manual



Abstract

THR provides high level utility functions for creating and using pools of persistent execution thread.

Contents

1 Introduction
A Function Descriptions
thrAddJob – Add a job to the list of jobs to be performed by a given workforce
thrBeginJobContext – Starts a new job context
thrCondBroadcast – A wrapper for pthread_cond_broadcast
thrCondInit – A wrapper for pthread_cond_init
thrCondSignal – A wrapper for pthread_cond_signal
thrCondWait – A wrapper for pthread_cond_wait
thrCreateWorkforce – Create a thread pool holding a specified number of threads
thrDestroyWorkforce – Destroy a workforce
thrEndJobContext – End the current job context
thrFreeFun – Register a function to delete a job data structure
thrGetJobData – Returns a job data pointer that was supplied when the job was created
thrGetJobs – Return a list of jobs in a given state
thrGetNThread – Determine the number of threads to use
thrGetWorkforce – Return a pointer to a singleton workforce
thrHaltJob – Halt a running job until other jobs have completed
thrJobWait – Wait for the next job to completed
thrMutexInit – A wrapper for pthread_mutex_init
thrMutexLock – A wrapper for pthread_mutex_lock
thrMutexUnlock – A wrapper for pthread_mutex_unlock
thrThreadCreate – A wrapper for pthread_create
thrThreadData – Returns a KeyMap that can be used to hold thread-specific global data
thrWait – Wait for a workforce to have completed all its jobs