Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > Vthread_impls > Vthread_MC_shared_impl
view VPThread.h @ 0:4aca264971b5
Initial add -- works w/matrix mult on 9x9 but dies on larger
| author | Me |
|---|---|
| date | Fri, 17 Sep 2010 11:34:02 -0700 |
| parents | |
| children | 1d3157ac56c4 |
line source
1 /*
2 * Copyright 2009 OpenSourceStewardshipFoundation.org
3 * Licensed under GNU General Public License version 2
4 *
5 * Author: seanhalle@yahoo.com
6 *
7 */
9 #ifndef _VPThread_H
10 #define _VPThread_H
12 #include "VMS/VMS.h"
13 #include "VMS/Queue_impl/PrivateQueue.h"
14 #include "VMS/DynArray/DynArray.h"
17 //===========================================================================
18 #define INIT_NUM_MUTEX 10000
19 #define INIT_NUM_COND 10000
20 //===========================================================================
22 /*This header defines everything specific to the VPThread semantic plug-in
23 */
24 typedef struct _VPThreadSemReq VPThreadSemReq;
27 /*Semantic layer-specific data sent inside a request from lib called in app
28 * to request handler called in MasterLoop
29 */
30 enum VPThreadReqType
31 {
32 make_mutex = 1,
33 mutex_lock,
34 mutex_unlock,
35 make_cond,
36 cond_wait,
37 cond_signal,
38 make_procr
39 };
41 struct _VPThreadSemReq
42 { enum VPThreadReqType reqType;
43 VirtProcr *requestingPr;
44 int32 mutexIdx;
45 int32 condIdx;
46 void *initData;
47 VirtProcrFnPtr fnPtr;
48 }
49 /* VPThreadSemReq */;
51 typedef struct
52 {
53 //Standard stuff will be in most every semantic env
54 PrivQueueStruc **readyVPQs;
55 int32 numVirtPr;
56 int32 nextCoreToGetNewPr;
58 //Specific to this semantic layer
59 int32 currMutexIdx;
60 DynArray32 *mutexDynArray;
62 int32 currCondIdx;
63 DynArray32 *condDynArray;
65 void *applicationGlobals;
66 }
67 VPThreadSemEnv;
70 typedef struct
71 {
72 int32 mutexIdx;
73 VirtProcr *holderOfLock;
74 PrivQueueStruc *waitingQueue;
75 }
76 VPTMutex;
79 typedef struct
80 {
81 int32 condIdx;
82 PrivQueueStruc *waitingQueue;
83 VPTMutex *partnerMutex;
84 }
85 VPTCond;
88 //===========================================================================
90 void
91 VPThread__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
93 //=======================
95 inline VirtProcr *
96 VPThread__create_thread( VirtProcrFnPtr fnPtr, void *initData,
97 VirtProcr *creatingPr );
99 void
100 VPThread__dissipate_thread( VirtProcr *procrToDissipate );
102 //=======================
103 void
104 VPThread__set_globals_to( void *globals );
106 void *
107 VPThread__give_globals();
109 //=======================
110 int32
111 VPThread__make_mutex( VirtProcr *animPr );
113 void
114 VPThread__mutex_lock( int32 mutexIdx, VirtProcr *acquiringPr );
116 void
117 VPThread__mutex_unlock( int32 mutexIdx, VirtProcr *releasingPr );
120 //=======================
121 int32
122 VPThread__make_cond( int32 ownedMutexIdx, VirtProcr *animPr);
124 void
125 VPThread__cond_wait( int32 condIdx, VirtProcr *waitingPr);
127 void *
128 VPThread__cond_signal( int32 condIdx, VirtProcr *signallingPr );
133 //========================= Internal use only =============================
134 void
135 VPThread__Request_Handler( VirtProcr *requestingPr, void *_semEnv );
137 VirtProcr *
138 VPThread__schedule_virt_procr( void *_semEnv, int coreNum );
140 //=======================
141 void
142 VPThread__free_semantic_request( VPThreadSemReq *semReq );
144 //=======================
146 void
147 VPThread__init();
149 void
150 VPThread__cleanup_after_shutdown();
152 #endif /* _VPThread_H */
