diff 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
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/SSR.h	Wed Sep 01 09:14:56 2010 -0700
     1.3 @@ -0,0 +1,125 @@
     1.4 +/*
     1.5 + *  Copyright 2009 OpenSourceStewardshipFoundation.org
     1.6 + *  Licensed under GNU General Public License version 2
     1.7 + *
     1.8 + * Author: seanhalle@yahoo.com
     1.9 + *
    1.10 + */
    1.11 +
    1.12 +#ifndef _SSR_H
    1.13 +#define	_SSR_H
    1.14 +
    1.15 +#include "VMS/Queue_impl/PrivateQueue.h"
    1.16 +#include "VMS/Hash_impl/PrivateHash.h"
    1.17 +#include "VMS/VMS.h"
    1.18 +
    1.19 +/*This header defines everything specific to the SSR semantic plug-in
    1.20 + */
    1.21 +typedef struct _SSRSemReq   SSRSemReq;
    1.22 +
    1.23 +
    1.24 +/*Semantic layer-specific data sent inside a request from lib called in app
    1.25 + * to request handler called in MasterLoop
    1.26 + */
    1.27 +enum SSRReqType
    1.28 + {
    1.29 +   send_type = 1,
    1.30 +   send_from_to,
    1.31 +   receive_any,    //order and grouping matter -- send before receive
    1.32 +   receive_type,   // and receive_any first of the receives -- Handlers
    1.33 +   receive_from_to,// rely upon this ordering of enum
    1.34 +   transfer_to,
    1.35 +   transfer_out
    1.36 + };
    1.37 +
    1.38 +struct _SSRSemReq
    1.39 + { enum SSRReqType    reqType;
    1.40 +   VirtProcr           *sendPr;
    1.41 +   VirtProcr           *receivePr;
    1.42 +   int32                msgType;
    1.43 +   void                *msg;
    1.44 +   SSRSemReq         *nextReqInHashEntry;
    1.45 + }
    1.46 +/* SSRSemReq */;
    1.47 +
    1.48 +typedef struct
    1.49 + {
    1.50 +   PrivQueueStruc *readyVirtProcrQ;
    1.51 +   HashTable      *commHashTbl;
    1.52 +   int             numVirtPr;
    1.53 + }
    1.54 +SSRSemEnv;
    1.55 +
    1.56 +
    1.57 +//===========================================================================
    1.58 +
    1.59 +void
    1.60 +SSR__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
    1.61 +
    1.62 +//=======================
    1.63 +
    1.64 +void
    1.65 +SSR__init();
    1.66 +
    1.67 +void
    1.68 +SSR__cleanup_after_shutdown();
    1.69 +
    1.70 +//=======================
    1.71 +
    1.72 +inline VirtProcr *
    1.73 +SSR__create_procr_with( VirtProcrFnPtr fnPtr, void *initData,
    1.74 +                          VirtProcr *creatingPr );
    1.75 +
    1.76 +void
    1.77 +SSR__dissipate_procr( VirtProcr *procrToDissipate );
    1.78 +
    1.79 +//=======================
    1.80 +void *
    1.81 +SSR__malloc_size_to( int numBytes, VirtProcr *ownerPr );
    1.82 +
    1.83 +void
    1.84 +SSR__transfer_ownership_of_from_to( void *data, VirtProcr *oldOwnerPr,
    1.85 +                                                    VirtProcr *newOwnerPr );
    1.86 +                                                    
    1.87 +void
    1.88 +SSR__add_ownership_by_to( VirtProcr *newOwnerPr, void *data );
    1.89 +
    1.90 +void
    1.91 +SSR__remove_ownership_by_from( VirtProcr *loserPr, void *dataLosing );
    1.92 +
    1.93 +void
    1.94 +SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
    1.95 +
    1.96 +
    1.97 +
    1.98 +//=======================
    1.99 +void
   1.100 +SSR__send_of_type_to( VirtProcr *sendPr, void *msg, const int type,
   1.101 +                        VirtProcr *receivePr);
   1.102 +
   1.103 +void
   1.104 +SSR__send_from_to( void *msg, VirtProcr *sendPr, VirtProcr *receivePr);
   1.105 +
   1.106 +void *
   1.107 +SSR__receive_type_to( const int type, VirtProcr *receivePr );
   1.108 +
   1.109 +void *
   1.110 +SSR__receive_from_to( VirtProcr *sendPr, VirtProcr *receivePr );
   1.111 +
   1.112 +
   1.113 +//=======================
   1.114 +
   1.115 +void
   1.116 +SSR__free_semantic_request( SSRSemReq *semReq );
   1.117 +
   1.118 +
   1.119 +//=========================  Internal use only  =============================
   1.120 +void
   1.121 +SSR__Request_Handler( VirtProcr *requestingPr, void *_semEnv );
   1.122 +
   1.123 +VirtProcr *
   1.124 +SSR__schedule_virt_procr( void *_semEnv );
   1.125 +
   1.126 +
   1.127 +#endif	/* _SSR_H */
   1.128 +