1 #ifndef __MLP_RUNTIME__
2 #define __MLP_RUNTIME__
7 #include "psemaphore.h"
18 // forward declaration of pointer type
19 typedef struct SESEcommon_t* SESEcommon_p;
21 // these fields are common to any SESE, and casting the
22 // generated SESE record to this can be used, because
23 // the common structure is always the first item in a
24 // customized SESE record
25 typedef struct SESEcommon_t {
27 // the identifier for the class of sese's that
28 // are instances of one particular static code block
31 // a parent waits on this semaphore when stalling on
32 // this child, the child gives it at its SESE exit
36 // the lock guards the following data SESE's
37 // use to coordinate with one another
40 struct Queue* forwardList;
41 int unresolvedDependencies;
43 pthread_cond_t doneCond;
46 pthread_cond_t runningChildrenCond;
47 int numRunningChildren;
54 // a thread-local stack of SESEs and function to
55 // ensure it is initialized once per thread
57 extern __thread struct Queue* seseCallStack;
58 extern __thread pthread_once_t mlpOnceObj;
59 void mlpInitOncePerThread();
61 extern __thread SESEcommon_p seseCaller;
64 // simple mechanical allocation and
65 // deallocation of SESE records
66 void* mlpCreateSESErecord( int size );
67 void mlpDestroySESErecord( void* seseRecord );
70 #endif /* __MLP_RUNTIME__ */