Back to index

courier  0.68.2
Classes | Defines | Functions
nopthread.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  cthreadinfo

Defines

#define cthread_go(cit, gofunc, arg)
#define cthread_lockcreate()   ( &cthread_dummy )
#define cthread_lockdestroy(p)
#define cthread_lock(p, func, arg)   ( (*func)(arg))

Functions

struct cthreadinfocthread_init (unsigned, unsigned, void(*)(void *), void(*)(void *))
void cthread_wait (struct cthreadinfo *)
void cthread_lockdestroy (struct cthreadlock *)
int cthread_lock (struct cthreadlock *, int(*)(void *), void *)

Define Documentation

#define cthread_go (   cit,
  gofunc,
  arg 
)
Value:
( (*gofunc)(cit->metadata_buf, arg),      \
              (*cit->workfunc)(cit->metadata_buf), \
              (*cit->cleanupfunc)(cit->metadata_buf), 0)

Definition at line 28 of file nopthread.h.

#define cthread_lock (   p,
  func,
  arg 
)    ( (*func)(arg))

Definition at line 41 of file nopthread.h.

struct cthreadlock * cthread_lockcreate ( )    ( &cthread_dummy ) [read]

Definition at line 39 of file nopthread.h.

#define cthread_lockdestroy (   p)

Definition at line 40 of file nopthread.h.


Function Documentation

struct cthreadinfo* cthread_init ( unsigned  ,
unsigned  ,
void(*)(void *)  ,
void(*)(void *)   
) [read]

Definition at line 17 of file nopthread.c.

{
cthreadinfo_t *cit;

       if ((cit=(cthreadinfo_t *)malloc(sizeof(cthreadinfo_t))) == 0)
              return (0);

       cit->cleanupfunc=cleanupfunc_;
       cit->workfunc=workfunc_;

       if ( (cit->metadata_buf=malloc(metasize)) == 0)
       {
              free( (char *)cit );
              return (0);
       }
       return (cit);
}

Here is the call graph for this function:

int cthread_lock ( struct cthreadlock ,
int(*)(void *)  ,
void *   
)

Definition at line 413 of file pthread.c.

{
int    rc;

       while (pthread_mutex_lock(&p->mutex))
       {
              perror("pthread_mutex_lock");
              sleep(3);
       }

       pthread_cleanup_push(&mutexcleanup, (void *)&p->mutex);

       rc= (*func)(arg);

       if (PTHREAD_CHK(pthread_mutex_unlock( &p->mutex )))
              perror("pthread_mutex_unlock");
       pthread_cleanup_pop(0);
       return (rc);
}

Here is the call graph for this function:

void cthread_lockdestroy ( struct cthreadlock )

Definition at line 407 of file pthread.c.

{
       pthread_mutex_destroy(&p->mutex);
       free( (char *)p );
}
void cthread_wait ( struct cthreadinfo )