Me@0: /* Me@0: * Copyright 2009 OpenSourceStewardshipFoundation.org Me@0: * Licensed under GNU General Public License version 2 Me@0: * Me@0: * Author: seanhalle@yahoo.com Me@0: * Me@0: */ Me@0: Me@0: #ifndef _VMSHW_H Me@0: #define _VMSHW_H Me@0: Me@1: #include "VMS/Queue_impl/PrivateQueue.h" Me@1: #include "VMS/Hash_impl/PrivateHash.h" Me@1: #include "VMS/VMS.h" Me@0: Me@0: /*This header defines everything specific to the VMSHW semantic plug-in Me@0: */ Me@1: typedef struct _VMSHWSemReq VMSHWSemReq; Me@0: Me@0: Me@0: /*Semantic layer-specific data sent inside a request from lib called in app Me@0: * to request handler called in MasterLoop Me@0: */ Me@1: enum VMSHWReqType Me@0: { Me@1: send_type = 1, Me@1: send_from_to, Me@1: receive_any, //order and grouping matter -- send before receive Me@1: receive_type, // and receive_any first of the receives -- Handlers Me@1: receive_from_to,// rely upon this ordering of enum Me@1: transfer_to, Me@1: transfer_out Me@0: }; Me@0: Me@1: struct _VMSHWSemReq Me@1: { enum VMSHWReqType reqType; Me@1: VirtProcr *sendPr; Me@1: VirtProcr *receivePr; Me@1: int32 msgType; Me@1: void *msg; Me@1: VMSHWSemReq *nextReqInHashEntry; Me@1: } Me@1: /* VMSHWSemReq */; Me@0: Me@0: typedef struct Me@0: { Me@1: PrivQueueStruc *readyVirtProcrQ; Me@1: HashTable *commHashTbl; Me@1: int numVirtPr; Me@1: } Me@1: VMSHWSemEnv; Me@0: Me@1: Me@1: //=========================================================================== Me@1: Me@1: void Me@1: VMSHW__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData ); Me@1: Me@1: //======================= Me@1: Me@1: void Me@1: VMSHW__init(); Me@1: Me@1: void Me@3: VMSHW__cleanup_after_shutdown(); Me@1: Me@1: //======================= Me@1: Me@1: inline VirtProcr * Me@1: VMSHW__create_procr_with( VirtProcrFnPtr fnPtr, void *initData, Me@1: VirtProcr *creatingPr ); Me@1: Me@1: void Me@1: VMSHW__dissipate_procr( VirtProcr *procrToDissipate ); Me@1: Me@1: //======================= Me@1: void * Me@1: VMSHW__malloc_size_to( int numBytes, VirtProcr *ownerPr ); Me@1: Me@1: void Me@1: VMSHW__transfer_ownership_of_from_to( void *data, VirtProcr *oldOwnerPr, Me@1: VirtProcr *newOwnerPr ); Me@1: Me@1: void Me@1: VMSHW__add_ownership_by_to( VirtProcr *newOwnerPr, void *data ); Me@1: Me@1: void Me@1: VMSHW__remove_ownership_by_from( VirtProcr *loserPr, void *dataLosing ); Me@1: Me@1: void Me@1: VMSHW__transfer_ownership_to_outside( void *dataToTransferOwnershipOf ); Me@1: Me@1: Me@1: Me@1: //======================= Me@1: void Me@1: VMSHW__send_of_type_to( VirtProcr *sendPr, void *msg, const int type, Me@1: VirtProcr *receivePr); Me@1: Me@1: void Me@1: VMSHW__send_from_to( void *msg, VirtProcr *sendPr, VirtProcr *receivePr); Me@1: Me@1: void * Me@1: VMSHW__receive_type_to( const int type, VirtProcr *receivePr ); Me@1: Me@1: void * Me@1: VMSHW__receive_from_to( VirtProcr *sendPr, VirtProcr *receivePr ); Me@1: Me@1: Me@1: //======================= Me@1: Me@1: void Me@1: VMSHW__free_semantic_request( VMSHWSemReq *semReq ); Me@1: Me@1: Me@1: //========================= Internal use only ============================= Me@1: void Me@1: VMSHW__Request_Handler( VirtProcr *requestingPr, void *_semEnv ); Me@1: Me@1: VirtProcr * Me@1: VMSHW__schedule_virt_procr( void *_semEnv ); Me@1: Me@0: Me@0: #endif /* _VMSHW_H */ Me@0: