comparison SSR.h @ 11:9172ea309065

Changed name of SingleMaster branch to SSR also
author Me
date Wed, 01 Sep 2010 09:14:56 -0700
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 1:160ac8447b86
1 /*
2 * Copyright 2009 OpenSourceStewardshipFoundation.org
3 * Licensed under GNU General Public License version 2
4 *
5 * Author: seanhalle@yahoo.com
6 *
7 */
8
9 #ifndef _SSR_H
10 #define _SSR_H
11
12 #include "VMS/Queue_impl/PrivateQueue.h"
13 #include "VMS/Hash_impl/PrivateHash.h"
14 #include "VMS/VMS.h"
15
16 /*This header defines everything specific to the SSR semantic plug-in
17 */
18 typedef struct _SSRSemReq SSRSemReq;
19
20
21 /*Semantic layer-specific data sent inside a request from lib called in app
22 * to request handler called in MasterLoop
23 */
24 enum SSRReqType
25 {
26 send_type = 1,
27 send_from_to,
28 receive_any, //order and grouping matter -- send before receive
29 receive_type, // and receive_any first of the receives -- Handlers
30 receive_from_to,// rely upon this ordering of enum
31 transfer_to,
32 transfer_out
33 };
34
35 struct _SSRSemReq
36 { enum SSRReqType reqType;
37 VirtProcr *sendPr;
38 VirtProcr *receivePr;
39 int32 msgType;
40 void *msg;
41 SSRSemReq *nextReqInHashEntry;
42 }
43 /* SSRSemReq */;
44
45 typedef struct
46 {
47 PrivQueueStruc *readyVirtProcrQ;
48 HashTable *commHashTbl;
49 int numVirtPr;
50 }
51 SSRSemEnv;
52
53
54 //===========================================================================
55
56 void
57 SSR__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
58
59 //=======================
60
61 void
62 SSR__init();
63
64 void
65 SSR__cleanup_after_shutdown();
66
67 //=======================
68
69 inline VirtProcr *
70 SSR__create_procr_with( VirtProcrFnPtr fnPtr, void *initData,
71 VirtProcr *creatingPr );
72
73 void
74 SSR__dissipate_procr( VirtProcr *procrToDissipate );
75
76 //=======================
77 void *
78 SSR__malloc_size_to( int numBytes, VirtProcr *ownerPr );
79
80 void
81 SSR__transfer_ownership_of_from_to( void *data, VirtProcr *oldOwnerPr,
82 VirtProcr *newOwnerPr );
83
84 void
85 SSR__add_ownership_by_to( VirtProcr *newOwnerPr, void *data );
86
87 void
88 SSR__remove_ownership_by_from( VirtProcr *loserPr, void *dataLosing );
89
90 void
91 SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
92
93
94
95 //=======================
96 void
97 SSR__send_of_type_to( VirtProcr *sendPr, void *msg, const int type,
98 VirtProcr *receivePr);
99
100 void
101 SSR__send_from_to( void *msg, VirtProcr *sendPr, VirtProcr *receivePr);
102
103 void *
104 SSR__receive_type_to( const int type, VirtProcr *receivePr );
105
106 void *
107 SSR__receive_from_to( VirtProcr *sendPr, VirtProcr *receivePr );
108
109
110 //=======================
111
112 void
113 SSR__free_semantic_request( SSRSemReq *semReq );
114
115
116 //========================= Internal use only =============================
117 void
118 SSR__Request_Handler( VirtProcr *requestingPr, void *_semEnv );
119
120 VirtProcr *
121 SSR__schedule_virt_procr( void *_semEnv );
122
123
124 #endif /* _SSR_H */
125