comparison VMS.h @ 7:f96e4b3b35c7

Added win thds
author Me
date Tue, 01 Jun 2010 05:32:41 -0700
parents 6c518bda83fe
children 4b58b9a2527b
comparison
equal deleted inserted replaced
1:7c4299dec858 2:b5e17705434e
9 #ifndef _VMS_H 9 #ifndef _VMS_H
10 #define _VMS_H 10 #define _VMS_H
11 11
12 #include "VMS_primitive_data_types.h" 12 #include "VMS_primitive_data_types.h"
13 #include "Queue_impl/BlockingQueue.h" 13 #include "Queue_impl/BlockingQueue.h"
14 #include <windows.h>
14 15
15 //This value is the number of hardware threads in the shared memory 16 //This value is the number of hardware threads in the shared memory
16 // machine -- make double that number scheduling slots, plus extra for master 17 // machine -- make double that number scheduling slots, plus extra for master
17 #define NUM_WORKERS 4 18 #define NUM_CORES 4
18 #define NUM_SCHED_SLOTS 9 19 #define NUM_SCHED_SLOTS 9
19 20
20 #define SUCCESS 0 21 #define SUCCESS 0
21 22
22 #define thdAttrs NULL 23 #define thdAttrs NULL
31 typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * ); 32 typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * );
32 typedef void VirtProcrFn( void *, VirtProcr * ); 33 typedef void VirtProcrFn( void *, VirtProcr * );
33 34
34 typedef struct 35 typedef struct
35 { 36 {
36 QueueStruc *workQ; 37 void *endThdPt;
37 unsigned int id; 38 unsigned int coreNum;
38 } 39 }
39 ThdParams; 40 ThdParams;
40 41
41 struct _SchedSlot 42 struct _SchedSlot
42 { 43 {
91 92
92 SlaveReqst *nextRequest; 93 SlaveReqst *nextRequest;
93 }; 94 };
94 95
95 96
96 97 DWORD WINAPI coreLoop( LPVOID paramsIn );
97 void * coreLoop( void *paramsIn ); //standard PThreads fn prototype 98 //void * coreLoop( void *paramsIn ); //standard PThreads fn prototype
99 void masterLoop( void *initData, VirtProcr *masterPr );
98 100
99 101
100 //===================== Global Vars =================== 102 //===================== Global Vars ===================
101 103
102 104
103 pthread_t coreLoopThds[ NUM_WORKERS ]; // std struc, holds thread info 105 HANDLE coreLoopThds[ NUM_CORES ]; //windows handle to thread
104 ThdParams thdParams[ NUM_WORKERS ]; 106 ThdParams *thdParams[ NUM_CORES ];
107 DWORD thdIds[ NUM_CORES ];
105 108
106 volatile MasterEnv *_VMSMasterEnv; 109 volatile MasterEnv *_VMSMasterEnv;
107 110
108 //workQ is global, static, and volatile so that core loop has its location 111 //workQ is global, static, and volatile so that core loop has its location
109 // hard coded, and reloads every time through the loop -- that way don't 112 // hard coded, and reloads every time through the loop -- that way don't
110 // need to save any regs used by core loop (will see if this really works) 113 // need to save any regs used by core loop (will see if this really works)
111 volatile QueueStruc *_VMSWorkQ; 114 volatile QueueStruc *_VMSWorkQ;
112 115
116 //==========================
117 void
118 VMS__init();
119
120 void
121 VMS__start();
122
123 VirtProcr *
124 VMS__create_procr( VirtProcrFnPtr fnPtr, void *initialData );
125
126 inline void
127 VMS__send_sem_request( void *semReqData, VirtProcr *callingPr );
128
129 void
130 VMS__suspend_processor( VirtProcr *callingPr );
131
113 132
114 #endif /* _VMS_H */ 133 #endif /* _VMS_H */
115 134