Me@6: /* Me@6: * Copyright 2009 OpenSourceStewardshipFoundation.org Me@6: * Licensed under GNU General Public License version 2 Me@6: * Me@6: * Author: seanhalle@yahoo.com Me@6: * Me@6: */ Me@6: Me@6: #ifndef _SSR_H Me@6: #define _SSR_H Me@6: Me@6: #include "VMS/Queue_impl/PrivateQueue.h" Me@6: #include "VMS/Hash_impl/PrivateHash.h" Me@6: #include "VMS/VMS.h" Me@6: Me@6: /*This header defines everything specific to the SSR semantic plug-in Me@6: */ Me@6: typedef struct _SSRSemReq SSRSemReq; Me@6: Me@6: Me@6: /*Semantic layer-specific data sent inside a request from lib called in app Me@6: * to request handler called in MasterLoop Me@6: */ Me@6: enum SSRReqType Me@6: { Me@6: send_type = 1, Me@6: send_from_to, Me@6: receive_any, //order and grouping matter -- send before receive Me@6: receive_type, // and receive_any first of the receives -- Handlers Me@6: receive_from_to,// rely upon this ordering of enum Me@6: transfer_to, Me@6: transfer_out Me@6: }; Me@6: Me@6: struct _SSRSemReq Me@6: { enum SSRReqType reqType; Me@6: VirtProcr *sendPr; Me@6: VirtProcr *receivePr; Me@6: int32 msgType; Me@6: void *msg; Me@6: SSRSemReq *nextReqInHashEntry; Me@6: } Me@6: /* SSRSemReq */; Me@6: Me@6: typedef struct Me@6: { Me@6: PrivQueueStruc **readyVPQs; Me@14: HashTable *commHashTbl; Me@14: int32 numVirtPr; Me@14: int32 nextCoreToGetNewPr; Me@14: int32 primitiveStartTime; Me@6: } Me@6: SSRSemEnv; Me@6: Me@6: Me@6: //=========================================================================== Me@6: Me@6: void Me@6: SSR__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData ); Me@6: Me@14: int32 Me@14: SSR__giveMinWorkUnitCycles( float32 percentOverhead ); Me@14: Me@14: void inline Me@14: SSR__start_primitive(); Me@14: Me@14: int32 inline Me@14: SSR__end_primitive_and_give_cycles(); Me@14: Me@14: Me@6: //======================= Me@6: Me@6: void Me@6: SSR__init(); Me@6: Me@6: void Me@6: SSR__cleanup_after_shutdown(); Me@6: Me@6: //======================= Me@6: Me@6: inline VirtProcr * Me@6: SSR__create_procr_with( VirtProcrFnPtr fnPtr, void *initData, Me@6: VirtProcr *creatingPr ); Me@6: Me@6: void Me@6: SSR__dissipate_procr( VirtProcr *procrToDissipate ); Me@6: Me@6: //======================= Me@6: void * Me@6: SSR__malloc_size_to( int numBytes, VirtProcr *ownerPr ); Me@6: Me@6: void Me@6: SSR__transfer_ownership_of_from_to( void *data, VirtProcr *oldOwnerPr, Me@6: VirtProcr *newOwnerPr ); Me@6: Me@6: void Me@6: SSR__add_ownership_by_to( VirtProcr *newOwnerPr, void *data ); Me@6: Me@6: void Me@6: SSR__remove_ownership_by_from( VirtProcr *loserPr, void *dataLosing ); Me@6: Me@6: void Me@6: SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf ); Me@6: Me@6: Me@6: Me@6: //======================= Me@6: void Me@6: SSR__send_of_type_to( VirtProcr *sendPr, void *msg, const int type, Me@6: VirtProcr *receivePr); Me@6: Me@6: void Me@6: SSR__send_from_to( void *msg, VirtProcr *sendPr, VirtProcr *receivePr); Me@6: Me@6: void * Me@6: SSR__receive_type_to( const int type, VirtProcr *receivePr ); Me@6: Me@6: void * Me@6: SSR__receive_from_to( VirtProcr *sendPr, VirtProcr *receivePr ); Me@6: Me@6: Me@6: //======================= Me@6: Me@6: void Me@6: SSR__free_semantic_request( SSRSemReq *semReq ); Me@6: Me@6: Me@6: //========================= Internal use only ============================= Me@6: void Me@6: SSR__Request_Handler( VirtProcr *requestingPr, void *_semEnv ); Me@6: Me@6: VirtProcr * Me@6: SSR__schedule_virt_procr( void *_semEnv, int coreNum ); Me@6: Me@6: Me@6: #endif /* _SSR_H */ Me@6: