found one reason for system hang--there is still at least one other problem that...
[IRC.git] / Robust / src / Runtime / mlp_runtime.h
1 #ifndef __MLP_RUNTIME__
2 #define __MLP_RUNTIME__
3
4
5 #include <pthread.h>
6 #include "Queue.h"
7 #include "psemaphore.h"
8
9
10 #ifndef FALSE
11 #define FALSE 0
12 #endif
13
14 #ifndef TRUE
15 #define TRUE 1
16 #endif
17
18 // forward declaration of pointer type
19 typedef struct SESEcommon_t* SESEcommon_p;
20
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 {  
26
27   // the identifier for the class of sese's that
28   // are instances of one particular static code block
29   int classID;
30
31   // a parent waits on this semaphore when stalling on
32   // this child, the child gives it at its SESE exit
33   psemaphore stallSem;
34
35   
36   // the lock guards the following data SESE's
37   // use to coordinate with one another
38   pthread_mutex_t lock;
39
40   struct Queue*   forwardList;
41   int             unresolvedDependencies;
42
43   pthread_cond_t  doneCond;
44   int             doneExecuting;
45
46   pthread_cond_t  runningChildrenCond;
47   int             numRunningChildren;
48
49   SESEcommon_p    parent;
50
51 } SESEcommon;
52
53
54 // simple mechanical allocation and 
55 // deallocation of SESE records
56 void* mlpCreateSESErecord( int size );
57 void  mlpDestroySESErecord( void* seseRecord );
58
59
60 #endif /* __MLP_RUNTIME__ */