view SSR.h @ 6:98fd084badde

Works multi-core.. pinned VP to a coreloop, changed to SSR
author Me
date Wed, 01 Sep 2010 08:22:54 -0700
parents
children bcc22f6f11a5
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 _SSR_H
10 #define _SSR_H
12 #include "VMS/Queue_impl/PrivateQueue.h"
13 #include "VMS/Hash_impl/PrivateHash.h"
14 #include "VMS/VMS.h"
16 /*This header defines everything specific to the SSR semantic plug-in
17 */
18 typedef struct _SSRSemReq SSRSemReq;
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 };
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 */;
45 typedef struct
46 {
47 PrivQueueStruc **readyVPQs;
48 HashTable *commHashTbl;
49 int numVirtPr;
50 int nextCoreToGetNewPr;
51 }
52 SSRSemEnv;
55 //===========================================================================
57 void
58 SSR__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
60 //=======================
62 void
63 SSR__init();
65 void
66 SSR__cleanup_after_shutdown();
68 //=======================
70 inline VirtProcr *
71 SSR__create_procr_with( VirtProcrFnPtr fnPtr, void *initData,
72 VirtProcr *creatingPr );
74 void
75 SSR__dissipate_procr( VirtProcr *procrToDissipate );
77 //=======================
78 void *
79 SSR__malloc_size_to( int numBytes, VirtProcr *ownerPr );
81 void
82 SSR__transfer_ownership_of_from_to( void *data, VirtProcr *oldOwnerPr,
83 VirtProcr *newOwnerPr );
85 void
86 SSR__add_ownership_by_to( VirtProcr *newOwnerPr, void *data );
88 void
89 SSR__remove_ownership_by_from( VirtProcr *loserPr, void *dataLosing );
91 void
92 SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
96 //=======================
97 void
98 SSR__send_of_type_to( VirtProcr *sendPr, void *msg, const int type,
99 VirtProcr *receivePr);
101 void
102 SSR__send_from_to( void *msg, VirtProcr *sendPr, VirtProcr *receivePr);
104 void *
105 SSR__receive_type_to( const int type, VirtProcr *receivePr );
107 void *
108 SSR__receive_from_to( VirtProcr *sendPr, VirtProcr *receivePr );
111 //=======================
113 void
114 SSR__free_semantic_request( SSRSemReq *semReq );
117 //========================= Internal use only =============================
118 void
119 SSR__Request_Handler( VirtProcr *requestingPr, void *_semEnv );
121 VirtProcr *
122 SSR__schedule_virt_procr( void *_semEnv, int coreNum );
125 #endif /* _SSR_H */