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

pt.h File Reference

#include <pthread.h>
#include <string.h>

Go to the source code of this file.

Compounds

struct  _pt_arg_t_
struct  _pt_gate_t_
struct  _pt_pipeline_t_

Defines

#define pt_create(t, start, arg, msg)
#define pt_create_detached(start, arg, msg)
#define pt_wait(t, exitcode, msg)
#define pt_exit(status)
#define pt_mutex_init(m, msg)
#define pt_mutex_destroy(m, msg)
#define pt_cond_init(c, msg)
#define pt_cond_destroy(c, msg)
#define pt_mutex_lock(m, msg)
#define pt_mutex_unlock(m, msg)
#define pt_cond_wait(c, m, msg)
#define pt_cond_broadcast(c, msg)
#define pt_cond_signal(c, msg)
#define pt_myid(th_arg)   ((th_arg)->myid)
#define pt_nthreads(th_arg)   ((th_arg)->nthreads)
#define pt_data(th_arg)   ((th_arg)->data)
#define pt_self(th_arg)   (&((th_arg)->self))
#define pt_thread(th_arg, id)   (&(((th_arg)-((th_arg)->myid)+(id))->self))
#define pt_cancel(th_arg, id)
#define pt_cancel_all(th_arg)
#define pt_fork(nt, start, arg, codes)
#define pt_pipeline_init(p, gdata, setup, stage)
#define F77PIPELINEINIT   pipeline_init_
#define F77PIPELINEDONE   pipeline_done_
#define F77PIPELINEEXEC   pipeline_execute_

Typedefs

typedef void *(* pt_startroutine_t )(void *)
typedef void * pt_addr_t
typedef _pt_arg_t_ pt_arg_t
typedef _pt_gate_t_ pt_gate_t
typedef _pt_pipeline_t_ pt_pipeline_t

Functions

int pt_mutex_trylock (pthread_mutex_t *m, char *msg)
void _pt_fork (int nthreads, pt_startroutine_t start, pt_addr_t arg, pt_addr_t *exitcodes)
void pt_gate_init (pt_gate_t *gate, int nthreads)
void pt_gate_destroy (pt_gate_t *gate)
void pt_gate_sync (pt_gate_t *gate)
void _pt_pipeline_init (pt_pipeline_t *p, pt_addr_t gdata, pt_startroutine_t setup, pt_startroutine_t stage)
void pt_pipeline_destroy (pt_pipeline_t *p)
void pt_pipeline_execute (pt_pipeline_t *p)


Define Documentation

#define F77PIPELINEDONE   pipeline_done_
 

Definition at line 289 of file pt.h.

#define F77PIPELINEEXEC   pipeline_execute_
 

Definition at line 290 of file pt.h.

#define F77PIPELINEINIT   pipeline_init_
 

Definition at line 288 of file pt.h.

#define pt_cancel th_arg,
id   
 

Value:

{ \
    int errcode; \
    \
    if (errcode=pthread_cancel(((th_arg)-((th_arg)->myid)+(id))->self)) { \
        fprintf(stderr,"%s: %s\n",msg,strerror(errcode)); \
        exit(1); \
    } \
}

Definition at line 201 of file pt.h.

#define pt_cancel_all th_arg   
 

Value:

{ \
    int myid=(th_arg)->myid,nt=(th_arg)->nthreads,i,errcode; \
    pt_arg_t *base=(th_arg)-myid; \
    \
    for (i=0; i<nt; i++) { \
        if (i==id) continue; \
        if (errcode=pthread_cancel(base[i].self)) { \
            fprintf(stderr,"%s: %s\n",msg,strerror(errcode)); \
            exit(1); \
        } \
    } \
}

Definition at line 211 of file pt.h.

#define pt_cond_broadcast c,
msg   
 

Value:

{ \
    int errcode; \
    \
    if (errcode=pthread_cond_broadcast(c)) { \
        fprintf(stderr,"%s: %s\n",msg,strerror(errcode)); \
        exit(1); \
    } \
}

Definition at line 164 of file pt.h.

#define pt_cond_destroy c,
msg   
 

Value:

{ \
    int errcode; \
    \
    if (errcode=pthread_cond_destroy(c)) { \
        fprintf(stderr,"%s: %s\n",msg,strerror(errcode)); \
        exit(1); \
    } \
}

Definition at line 119 of file pt.h.

#define pt_cond_init c,
msg   
 

Value:

{ \
    int errcode; \
    \
    if (errcode=pthread_cond_init(c,NULL)) { \
        fprintf(stderr,"%s: %s\n",msg,strerror(errcode)); \
        exit(1); \
    } \
}

Definition at line 109 of file pt.h.

#define pt_cond_signal c,
msg   
 

Value:

{ \
    int errcode; \
    \
    if (errcode=pthread_cond_signal(c)) { \
        fprintf(stderr,"%s: %s\n",msg,strerror(errcode)); \
        exit(1); \
    } \
}

Definition at line 174 of file pt.h.

#define pt_cond_wait c,
m,
msg   
 

Value:

{ \
    int errcode; \
    \
    if (errcode=pthread_cond_wait(c,m)) { \
        fprintf(stderr,"%s: %s\n",msg,strerror(errcode)); \
        exit(1); \
    } \
}

Definition at line 154 of file pt.h.

#define pt_create t,
start,
arg,
msg   
 

Value:

{ \
    int errcode; \
    \
    if (errcode=pthread_create(t, \
                               NULL, \
                               (pt_startroutine_t) (start), \
                               (pt_addr_t) (arg))) { \
        fprintf(stderr,"%s: %s\n",msg,strerror(errcode)); \
        exit(1); \
    } \
}

Definition at line 41 of file pt.h.

#define pt_create_detached start,
arg,
msg   
 

Value:

{ \
    pthread_t t; \
    int errcode; \
    \
    if (errcode=pthread_create(&t, \
                               NULL, \
                               (pt_startroutine_t) (start), \
                               (pt_addr_t) (arg))) { \
        fprintf(stderr,"%s: %s\n",msg,strerror(errcode)); \
        exit(1); \
    } \
    if (pthread_detach(t)) { \
        fprintf(stderr,"%s: %s\n",msg,strerror(errcode)); \
        exit(1); \
    } \
}

Definition at line 54 of file pt.h.

#define pt_data th_arg       ((th_arg)->data)
 

Definition at line 197 of file pt.h.

#define pt_exit status   
 

Value:

{ \
    pthread_exit(status); \
}

Definition at line 84 of file pt.h.

#define pt_fork nt,
start,
arg,
codes   
 

Value:

_pt_fork(nt,(pt_startroutine_t) start, \
           (pt_addr_t) arg,(pt_addr_t *) codes)

Definition at line 230 of file pt.h.

#define pt_mutex_destroy m,
msg   
 

Value:

{ \
    int errcode; \
    \
    if (errcode=pthread_mutex_destroy(m)) { \
        fprintf(stderr,"%s: %s\n",msg,strerror(errcode)); \
        exit(1); \
    } \
}

Definition at line 99 of file pt.h.

Referenced by matvec::GLMM::build_hInv().

#define pt_mutex_init m,
msg   
 

Value:

{ \
    int errcode; \
    \
    if (errcode=pthread_mutex_init(m,NULL)) { \
        fprintf(stderr,"%s: %s\n",msg,strerror(errcode)); \
        exit(1); \
    } \
}

Definition at line 89 of file pt.h.

Referenced by matvec::GLMM::build_hInv().

#define pt_mutex_lock m,
msg   
 

Value:

{ \
    int errcode; \
    \
    if (errcode=pthread_mutex_lock(m)) { \
        fprintf(stderr,"%s: %s\n",msg,strerror(errcode)); \
        exit(1); \
    } \
}

Definition at line 129 of file pt.h.

#define pt_mutex_unlock m,
msg   
 

Value:

{ \
    int errcode; \
    \
    if (errcode=pthread_mutex_unlock(m)) { \
        fprintf(stderr,"%s: %s\n",msg,strerror(errcode)); \
        exit(1); \
    } \
}

Definition at line 144 of file pt.h.

#define pt_myid th_arg       ((th_arg)->myid)
 

Definition at line 195 of file pt.h.

#define pt_nthreads th_arg       ((th_arg)->nthreads)
 

Definition at line 196 of file pt.h.

#define pt_pipeline_init p,
gdata,
setup,
stage   
 

Value:

Definition at line 268 of file pt.h.

#define pt_self th_arg       (&((th_arg)->self))
 

Definition at line 198 of file pt.h.

#define pt_thread th_arg,
id       (&(((th_arg)-((th_arg)->myid)+(id))->self))
 

Definition at line 199 of file pt.h.

#define pt_wait t,
exitcode,
msg   
 

Value:

{ \
    pt_addr_t code; \
    int errcode; \
    \
    if (errcode=pthread_join(*(t), \
                      (pt_addr_t) ((exitcode)==NULL ? &code : (exitcode)))) { \
        fprintf(stderr,"%s: %s\n",msg,strerror(errcode)); \
        exit(1); \
    } \
}

Definition at line 72 of file pt.h.


Typedef Documentation

typedef void* pt_addr_t
 

Definition at line 36 of file pt.h.

typedef struct _pt_arg_t_ pt_arg_t
 

typedef struct _pt_gate_t_ pt_gate_t
 

typedef struct _pt_pipeline_t_ pt_pipeline_t
 

typedef void*(* pt_startroutine_t)(void *)
 

Definition at line 35 of file pt.h.


Function Documentation

void _pt_fork int    nthreads,
pt_startroutine_t    start,
pt_addr_t    arg,
pt_addr_t   exitcodes
 

void _pt_pipeline_init pt_pipeline_t   p,
pt_addr_t    gdata,
pt_startroutine_t    setup,
pt_startroutine_t    stage
 

void pt_gate_destroy pt_gate_t   gate
 

void pt_gate_init pt_gate_t   gate,
int    nthreads
 

void pt_gate_sync pt_gate_t   gate
 

int pt_mutex_trylock pthread_mutex_t *    m,
char *    msg
 

void pt_pipeline_destroy pt_pipeline_t   p
 

void pt_pipeline_execute pt_pipeline_t   p
 


Generated on Thu Jun 16 17:14:11 2005 for Matvec by doxygen1.2.16