Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

cpmthread.c File Reference

#include "cpmthread.h"

Include dependency graph for cpmthread.c:

Include dependency graph

Go to the source code of this file.

Functions

pmthread pmthread_new (void *(*thread)(void *args), void *args)
int pmthread_destroy (pmthread threadID)
int pmthread_wait (pmthread threadID)
pmmutex pmmutex_new ()
int pmmutex_destroy (pmmutex *mutex)
int pmmutex_lock (pmmutex *mutex)
int pmmutex_unlock (pmmutex *mutex)
pmcond pmcond_new ()
int pmcond_destroy (pmcond *cond)
int pmcond_wait (pmcond *cond, pmmutex *mutex)
int pmcond_signal (pmcond *cond)
int pmcond_broadcast (pmcond *cond)


Function Documentation

int pmcond_broadcast pmcond cond  ) 
 

Definition at line 87 of file cpmthread.c.

References PMTHREAD_ERROR.

00088 {
00089         int ret = pthread_cond_broadcast(cond);
00090 
00091         return ret ? PMTHREAD_ERROR : 0;
00092 }

int pmcond_destroy pmcond cond  ) 
 

Definition at line 66 of file cpmthread.c.

References PMTHREAD_ERROR.

00067 {
00068         int ret = pthread_cond_destroy(cond);
00069 
00070         return ret ? PMTHREAD_ERROR : 0;
00071 }

pmcond pmcond_new  ) 
 

Definition at line 58 of file cpmthread.c.

References pmcond.

00059 {
00060         pmcond cond;
00061         pthread_cond_init(&cond, NULL);
00062 
00063         return cond;
00064 }

int pmcond_signal pmcond cond  ) 
 

Definition at line 80 of file cpmthread.c.

References PMTHREAD_ERROR.

00081 {
00082         int ret = pthread_cond_signal(cond);
00083 
00084         return ret ? PMTHREAD_ERROR : 0;
00085 }

int pmcond_wait pmcond cond,
pmmutex mutex
 

Definition at line 73 of file cpmthread.c.

References PMTHREAD_ERROR.

00074 {
00075         int ret = pthread_cond_wait(cond, mutex);
00076 
00077         return ret ? PMTHREAD_ERROR : 0;
00078 }

int pmmutex_destroy pmmutex mutex  ) 
 

Definition at line 36 of file cpmthread.c.

References PMTHREAD_ERROR.

00037 {
00038         int ret = pthread_mutex_destroy(mutex);
00039 
00040         return ret ? PMTHREAD_ERROR : 0;
00041 }

int pmmutex_lock pmmutex mutex  ) 
 

Definition at line 43 of file cpmthread.c.

References PMTHREAD_ERROR.

00044 {
00045         int ret = pthread_mutex_lock(mutex);
00046 
00047         return ret ? PMTHREAD_ERROR : 0;
00048 }

pmmutex pmmutex_new  ) 
 

Definition at line 28 of file cpmthread.c.

References pmmutex.

00029 {
00030         pmmutex mutex;
00031         pthread_mutex_init(&mutex, NULL);
00032 
00033         return mutex;
00034 }

int pmmutex_unlock pmmutex mutex  ) 
 

Definition at line 50 of file cpmthread.c.

References PMTHREAD_ERROR.

00051 {
00052         int ret = pthread_mutex_unlock(mutex);
00053 
00054         return ret ? PMTHREAD_ERROR : 0;
00055 }

int pmthread_destroy pmthread  threadID  ) 
 

Definition at line 12 of file cpmthread.c.

References PMTHREAD_ERROR.

00013 {
00014         int ret = pthread_cancel(threadID);
00015 
00016         return ret ? PMTHREAD_ERROR : 0;
00017 }

pmthread pmthread_new void *(*  thread)(void *args),
void *  args
 

Definition at line 4 of file cpmthread.c.

References pmthread, and PMTHREAD_ERROR.

00005 {
00006         pmthread id;
00007         int ret = pthread_create(&id, NULL, thread, args);
00008 
00009         return ret ? PMTHREAD_ERROR : id;
00010 }

int pmthread_wait pmthread  threadID  ) 
 

Definition at line 19 of file cpmthread.c.

References PMTHREAD_ERROR.

00020 {
00021         int ret = pthread_join(threadID, NULL);
00022         ret |= pthread_detach(threadID);
00023 
00024         return ret ? PMTHREAD_ERROR : 0;
00025 }


Generated on Mon Dec 1 17:00:45 2003 for Protomake by doxygen1.3