Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-03-13 09:29:39

0001 /*
0002 
0003 Copyright 1991, 1993, 1994, 1998  The Open Group
0004 
0005 Permission to use, copy, modify, distribute, and sell this software and its
0006 documentation for any purpose is hereby granted without fee, provided that
0007 the above copyright notice appear in all copies and that both that
0008 copyright notice and this permission notice appear in supporting
0009 documentation.
0010 
0011 The above copyright notice and this permission notice shall be included in
0012 all copies or substantial portions of the Software.
0013 
0014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
0017 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
0018 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0019 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0020 
0021 Except as contained in this notice, the name of The Open Group shall not be
0022 used in advertising or otherwise to promote the sale, use or other dealings
0023 in this Software without prior written authorization from The Open Group.
0024 
0025 */
0026 
0027 /***********************************************************
0028 Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
0029 and Olivetti Research Limited, Cambridge, England.
0030 
0031                         All Rights Reserved
0032 
0033 Permission to use, copy, modify, and distribute this software and its 
0034 documentation for any purpose and without fee is hereby granted, 
0035 provided that the above copyright notice appear in all copies and that
0036 both that copyright notice and this permission notice appear in 
0037 supporting documentation, and that the names of Digital or Olivetti
0038 not be used in advertising or publicity pertaining to distribution of the
0039 software without specific, written prior permission.  
0040 
0041 DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
0042 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
0043 FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR
0044 CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
0045 USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
0046 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
0047 PERFORMANCE OF THIS SOFTWARE.
0048 
0049 ******************************************************************/
0050 
0051 #ifndef _SYNCSTR_H_
0052 #define _SYNCSTR_H_
0053 
0054 #include <X11/extensions/syncproto.h>
0055 
0056 #ifdef _SYNC_SERVER
0057 
0058 #define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */
0059 
0060 typedef struct _SyncCounter {
0061     ClientPtr       client; /* Owning client. 0 for system counters */
0062     XSyncCounter    id;     /* resource ID */
0063     CARD64      value;      /* counter value */
0064     struct _SyncTriggerList *pTriglist; /* list of triggers */
0065     Bool        beingDestroyed; /* in process of going away */
0066     struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */
0067 } SyncCounter;
0068 
0069 /*
0070  * The System Counter interface
0071  */
0072 
0073 typedef enum {
0074     XSyncCounterNeverChanges,
0075     XSyncCounterNeverIncreases,
0076     XSyncCounterNeverDecreases,
0077     XSyncCounterUnrestricted
0078 } SyncCounterType;
0079 
0080 typedef struct _SysCounterInfo {
0081     char    *name;
0082     CARD64  resolution;
0083     CARD64  bracket_greater;
0084     CARD64  bracket_less;
0085     SyncCounterType counterType;  /* how can this counter change */
0086     void        (*QueryValue)(
0087                   pointer /*pCounter*/,
0088                   CARD64 * /*freshvalue*/
0089 );
0090     void    (*BracketValues)(
0091                  pointer /*pCounter*/,
0092                  CARD64 * /*lessthan*/,
0093                  CARD64 * /*greaterthan*/
0094 );
0095 } SysCounterInfo;
0096 
0097 
0098 
0099 typedef struct _SyncTrigger {
0100     SyncCounter *pCounter;
0101     CARD64  wait_value; /* wait value */
0102     unsigned int value_type;     /* Absolute or Relative */
0103     unsigned int test_type; /* transition or Comparision type */
0104     CARD64  test_value; /* trigger event threshold value */
0105     Bool    (*CheckTrigger)(
0106                 struct _SyncTrigger * /*pTrigger*/,
0107                 CARD64 /*newval*/
0108                 );
0109     void    (*TriggerFired)(
0110                 struct _SyncTrigger * /*pTrigger*/
0111                 );
0112     void    (*CounterDestroyed)(
0113                 struct _SyncTrigger * /*pTrigger*/
0114                     );
0115 } SyncTrigger;
0116 
0117 typedef struct _SyncTriggerList {
0118     SyncTrigger *pTrigger;
0119     struct _SyncTriggerList *next;
0120 } SyncTriggerList;
0121 
0122 typedef struct _SyncAlarmClientList {
0123     ClientPtr   client;
0124     XID     delete_id;
0125     struct _SyncAlarmClientList *next;
0126 } SyncAlarmClientList;
0127 
0128 typedef struct _SyncAlarm {
0129     SyncTrigger trigger;
0130     ClientPtr   client;
0131     XSyncAlarm  alarm_id;
0132     CARD64  delta;
0133     int     events;
0134     int     state;
0135     SyncAlarmClientList *pEventClients;
0136 } SyncAlarm;
0137 
0138 typedef struct {
0139     ClientPtr   client;
0140     CARD32  delete_id;
0141     int     num_waitconditions;
0142 } SyncAwaitHeader;
0143 
0144 typedef struct {
0145     SyncTrigger trigger;
0146     CARD64  event_threshold;
0147     SyncAwaitHeader *pHeader;
0148 } SyncAwait;
0149 
0150 typedef union {
0151     SyncAwaitHeader header;
0152     SyncAwait       await;
0153 } SyncAwaitUnion;
0154 
0155 
0156 extern pointer SyncCreateSystemCounter(
0157     char *  /* name */,
0158     CARD64      /* inital_value */,
0159     CARD64      /* resolution */,
0160     SyncCounterType /* change characterization */,
0161     void        (* /*QueryValue*/ ) (
0162         pointer /* pCounter */,
0163         CARD64 * /* pValue_return */), /* XXX prototype */
0164     void        (* /*BracketValues*/) (
0165         pointer /* pCounter */, 
0166         CARD64 * /* pbracket_less */,
0167         CARD64 * /* pbracket_greater */)
0168 );
0169 
0170 extern void SyncChangeCounter(
0171     SyncCounter *   /* pCounter*/,
0172     CARD64          /* new_value */
0173 );
0174 
0175 extern void SyncDestroySystemCounter(
0176     pointer pCounter
0177 );
0178 extern void InitServertime(void);
0179 
0180 #endif /* _SYNC_SERVER */
0181 
0182 #endif /* _SYNCSTR_H_ */