(file) Return to sync.c CVS log (file) (dir) Up to [XFree86 CVS] / xc / programs / Xserver / Xext

Diff for /xc/programs/Xserver/Xext/sync.c between version 3.0 and 3.1

version 3.0, 1994/05/08 05:17:34 version 3.1, 1996/05/06 05:55:35
Line 1 
Line 1 
 /* $XConsortium: sync.c,v 1.10 94/04/17 20:32:58 dpw Exp $ */ /* $XConsortium: sync.c,v 1.10 94/04/17 20:32:58 dpw Exp $ */
 /* $XFree86$ */  /* $XFree86: xc/programs/Xserver/Xext/sync.c,v 3.0 1994/05/08 05:17:34 dawes Exp $ */
 /* /*
  
 Copyright (c) 1991, 1993  X Consortium Copyright (c) 1991, 1993  X Consortium
Line 90 
Line 90 
 #define XSyncCAAllTrigger \ #define XSyncCAAllTrigger \
     (XSyncCACounter | XSyncCAValueType | XSyncCAValue | XSyncCATestType)     (XSyncCACounter | XSyncCAValueType | XSyncCAValue | XSyncCATestType)
  
   static int
   FreeAlarm(
   #if NeedFunctionPrototypes
       pointer /* addr */,
       XID /* id */
   #endif
   );
   
   static int
   FreeAlarmClient(
   #if NeedFunctionPrototypes
       pointer /* value */,
       XID /* id */
   #endif
   );
   
   static int
   FreeAwait(
   #if NeedFunctionPrototypes
       pointer /* addr */,
       XID /* id */
   #endif
   );
   
   static void
   ServertimeBracketValues(
   #if NeedFunctionPrototypes
       pointer /* pCounter */,
       CARD64 * /* pbracket_less */,
       CARD64 * /* pbracket_greater */
   #endif
   );
   
   static void
   ServertimeQueryValue(
   #if NeedFunctionPrototypes
       pointer /* pCounter */,
       CARD64 * /* pValue_return */
   #endif
   );
   
   static void
   ServertimeWakeupHandler(
   #if NeedFunctionPrototypes
       pointer /* env */,
       int /* rc */,
       pointer /* LastSelectMask */
   #endif
   );
   
   static int
   SyncInitTrigger(
   #if NeedFunctionPrototypes
       ClientPtr /* client */,
       SyncTrigger * /* pTrigger */,
       XSyncCounter /* counter */,
       Mask /* changes */
   #endif
   );
   
   static void
   SAlarmNotifyEvent(
   #if NeedFunctionPrototypes
       xSyncAlarmNotifyEvent * /* from */,
       xSyncAlarmNotifyEvent * /* to */
   #endif
   );
   
   static void
   SCounterNotifyEvent(
   #if NeedFunctionPrototypes
       xSyncCounterNotifyEvent * /* from */,
       xSyncCounterNotifyEvent * /* to */
   #endif
   );
   
   static void
   ServertimeBlockHandler(
   #if NeedFunctionPrototypes
       pointer  /* env */,
       struct timeval ** /* wt */,
       pointer  /* LastSelectMask */
   #endif
   );
   
   static int
   SyncAddTriggerToCounter(
   #if NeedFunctionPrototypes
       SyncTrigger * /* pTrigger */
   #endif
   );
   
   extern void
   SyncAlarmCounterDestroyed(
   #if NeedFunctionPrototypes
       SyncTrigger * /* pTrigger */
   #endif
   );
   
   static void
   SyncAlarmTriggerFired(
   #if NeedFunctionPrototypes
       SyncTrigger * /* pTrigger */
   #endif
   );
   
   static void
   SyncAwaitTriggerFired(
   #if NeedFunctionPrototypes
       SyncTrigger * /* pTrigger */
   #endif
   );
   
   static int
   SyncChangeAlarmAttributes(
   #if NeedFunctionPrototypes
       ClientPtr /* client */,
       SyncAlarm * /* pAlarm */,
       Mask /* mask */,
       CARD32 * /* values */
   #endif
   );
   
   static Bool
   SyncCheckTriggerNegativeComparison(
   #if NeedFunctionPrototypes
       SyncTrigger * /* pTrigger */,
       CARD64 /* oldval */
   #endif
   );
   
   static Bool
   SyncCheckTriggerNegativeTransition(
   #if NeedFunctionPrototypes
       SyncTrigger * /* pTrigger */,
       CARD64 /* oldval */
   #endif
   );
   
   static Bool
   SyncCheckTriggerPositiveComparison(
   #if NeedFunctionPrototypes
       SyncTrigger * /* pTrigger */,
       CARD64 /* oldval */
   #endif
   );
   
   static Bool
   SyncCheckTriggerPositiveTransition(
   #if NeedFunctionPrototypes
       SyncTrigger * /* pTrigger */,
       CARD64 /* oldval */
   #endif
   );
   
   static SyncCounter *
   SyncCreateCounter(
   #if NeedFunctionPrototypes
       ClientPtr /* client */,
       XSyncCounter /* id */,
       CARD64 /* initialvalue */
   #endif
   );
   
 static void SyncComputeBracketValues( static void SyncComputeBracketValues(
 #if NeedFunctionPrototypes #if NeedFunctionPrototypes
                                      SyncCounter * /* pCounter */,                                      SyncCounter * /* pCounter */,
Line 97 
Line 261 
 #endif #endif
 ); );
  
   static void
   SyncDeleteTriggerFromCounter(
   #if NeedFunctionPrototypes
       SyncTrigger * /* pTrigger */
   #endif
   );
   
   static Bool
   SyncEventSelectForAlarm(
   #if NeedFunctionPrototypes
       SyncAlarm * /* pAlarm */,
       ClientPtr /* client */,
       Bool /* wantevents */
   #endif
   );
   
   static void
   SyncInitServerTime(
   #if NeedFunctionPrototypes
       void
   #endif
   );
   
   static void
   SyncResetProc(
   #if NeedFunctionPrototypes
       ExtensionEntry * /* extEntry */
   #endif
   );
   
   static void
   SyncSendAlarmNotifyEvents(
   #if NeedFunctionPrototypes
       SyncAlarm * /* pAlarm */
   #endif
   );
   
   static void
   SyncSendCounterNotifyEvents(
   #if NeedFunctionPrototypes
       ClientPtr /* client */,
       SyncAwait ** /* ppAwait */,
       int /* num_events */
   #endif
   );
   
   static DISPATCH_PROC(ProcSyncAwait);
   static DISPATCH_PROC(ProcSyncChangeAlarm);
   static DISPATCH_PROC(ProcSyncChangeCounter);
   static DISPATCH_PROC(ProcSyncCreateAlarm);
   static DISPATCH_PROC(ProcSyncCreateCounter);
   static DISPATCH_PROC(ProcSyncDestroyAlarm);
   static DISPATCH_PROC(ProcSyncDestroyCounter);
   static DISPATCH_PROC(ProcSyncDispatch);
   static DISPATCH_PROC(ProcSyncGetPriority);
   static DISPATCH_PROC(ProcSyncInitialize);
   static DISPATCH_PROC(ProcSyncListSystemCounters);
   static DISPATCH_PROC(ProcSyncListSystemCounters);
   static DISPATCH_PROC(ProcSyncQueryAlarm);
   static DISPATCH_PROC(ProcSyncQueryCounter);
   static DISPATCH_PROC(ProcSyncSetCounter);
   static DISPATCH_PROC(ProcSyncSetPriority);
   static DISPATCH_PROC(SProcSyncAwait);
   static DISPATCH_PROC(SProcSyncChangeAlarm);
   static DISPATCH_PROC(SProcSyncChangeCounter);
   static DISPATCH_PROC(SProcSyncCreateAlarm);
   static DISPATCH_PROC(SProcSyncCreateCounter);
   static DISPATCH_PROC(SProcSyncDestroyAlarm);
   static DISPATCH_PROC(SProcSyncDestroyCounter);
   static DISPATCH_PROC(SProcSyncDispatch);
   static DISPATCH_PROC(SProcSyncDispatch);
   static DISPATCH_PROC(SProcSyncGetPriority);
   static DISPATCH_PROC(SProcSyncInitialize);
   static DISPATCH_PROC(SProcSyncListSystemCounters);
   static DISPATCH_PROC(SProcSyncQueryAlarm);
   static DISPATCH_PROC(SProcSyncQueryCounter);
   static DISPATCH_PROC(SProcSyncSetCounter);
   static DISPATCH_PROC(SProcSyncSetPriority);
   
 /*  Each counter maintains a simple linked list of triggers that are /*  Each counter maintains a simple linked list of triggers that are
  *  interested in the counter.  The two functions below are used to  *  interested in the counter.  The two functions below are used to
  *  delete and add triggers on this list.  *  delete and add triggers on this list.
Line 465 
Line 708 
     {     {
         Bool overflow;         Bool overflow;
         CARD64 oldvalue;         CARD64 oldvalue;
         SyncTrigger *pTrigger = &pAlarm->trigger;          SyncTrigger *paTrigger = &pAlarm->trigger;
  
         /* "The alarm is updated by repeatedly adding delta to the         /* "The alarm is updated by repeatedly adding delta to the
          *  value of the trigger and re-initializing it until it          *  value of the trigger and re-initializing it until it
          *  becomes FALSE."          *  becomes FALSE."
          */          */
         oldvalue = pTrigger->test_value;          oldvalue = paTrigger->test_value;
  
         /* XXX really should do something smarter here */         /* XXX really should do something smarter here */
  
         do         do
         {         {
             XSyncValueAdd(&pTrigger->test_value, pTrigger->test_value,              XSyncValueAdd(&paTrigger->test_value, paTrigger->test_value,
                           pAlarm->delta, &overflow);                           pAlarm->delta, &overflow);
         } while (!overflow &&         } while (!overflow &&
               (*pTrigger->CheckTrigger)(pTrigger,                (*paTrigger->CheckTrigger)(paTrigger,
                                         pTrigger->pCounter->value));                                          paTrigger->pCounter->value));
  
         new_test_value = pTrigger->test_value;          new_test_value = paTrigger->test_value;
         pTrigger->test_value = oldvalue;          paTrigger->test_value = oldvalue;
  
         /* "If this update would cause value to fall outside the range         /* "If this update would cause value to fall outside the range
          *  for an INT64...no change is made to value (test-value) and          *  for an INT64...no change is made to value (test-value) and
Line 713 
Line 956 
     Mask            mask;     Mask            mask;
     CARD32          *values;     CARD32          *values;
 { {
     SyncAlarmClientList    *pClients;  
     int            status;     int            status;
     XSyncCounter   counter;     XSyncCounter   counter;
     Mask           origmask = mask;     Mask           origmask = mask;
Line 722 
Line 964 
  
     while (mask)     while (mask)
     {     {
         int    index = lowbit(mask);          int    index2 = lowbit(mask);
         mask &= ~index;          mask &= ~index2;
         switch (index)          switch (index2)
         {         {
           case XSyncCACounter:           case XSyncCACounter:
             mask &= ~XSyncCACounter;             mask &= ~XSyncCACounter;
Line 1001 
Line 1243 
     XID             id;     XID             id;
 { {
     SyncAlarm      *pAlarm = (SyncAlarm *) addr;     SyncAlarm      *pAlarm = (SyncAlarm *) addr;
     SyncAlarmClientList    *pClient;  
  
     pAlarm->state = XSyncAlarmDestroyed;     pAlarm->state = XSyncAlarmDestroyed;
  
Line 1142 
Line 1383 
 ProcSyncInitialize(client) ProcSyncInitialize(client)
     ClientPtr       client;     ClientPtr       client;
 { {
     REQUEST(xSyncInitializeReq);  
     xSyncInitializeReply  rep;     xSyncInitializeReply  rep;
     int   n;     int   n;
  
Line 1169 
Line 1409 
 ProcSyncListSystemCounters(client) ProcSyncListSystemCounters(client)
     ClientPtr       client;     ClientPtr       client;
 { {
     REQUEST(xSyncListSystemCountersReq);  
     xSyncListSystemCountersReply  rep;     xSyncListSystemCountersReply  rep;
     int i, len;     int i, len;
     xSyncSystemCounter *list, *walklist;     xSyncSystemCounter *list, *walklist;
Line 1320 
Line 1559 
     ClientPtr       client;     ClientPtr       client;
 { {
     REQUEST(xSyncCreateCounterReq);     REQUEST(xSyncCreateCounterReq);
     SyncCounter    *pCounter;  
     CARD64          initial;     CARD64          initial;
  
     REQUEST_SIZE_MATCH(xSyncCreateCounterReq);     REQUEST_SIZE_MATCH(xSyncCreateCounterReq);
Line 1439 
Line 1677 
 { {
     REQUEST(xSyncAwaitReq);     REQUEST(xSyncAwaitReq);
     int             len, items;     int             len, items;
     int             n, i;      int             i;
     xSyncWaitCondition *pProtocolWaitConds;     xSyncWaitCondition *pProtocolWaitConds;
     int             ret;  
     SyncAwaitUnion *pAwaitUnion;     SyncAwaitUnion *pAwaitUnion;
     SyncAwait      *pAwait;     SyncAwait      *pAwait;
     int            status;     int            status;
Line 1604 
Line 1841 
     REQUEST(xSyncCreateAlarmReq);     REQUEST(xSyncCreateAlarmReq);
     SyncAlarm      *pAlarm;     SyncAlarm      *pAlarm;
     int             status;     int             status;
     int             i;  
     unsigned long   len, vmask;     unsigned long   len, vmask;
     SyncTrigger     *pTrigger;     SyncTrigger     *pTrigger;
  
Line 2058 
Line 2294 
 SProcSyncDispatch(client) SProcSyncDispatch(client)
     ClientPtr       client;     ClientPtr       client;
 { {
     int             n;  
   
     REQUEST(xReq);     REQUEST(xReq);
  
     switch (stuff->data)     switch (stuff->data)
Line 2149 
Line 2383 
 } }
  
  
 static void SyncInitServerTime();  
   
 /* /*
  * ** Initialise the extension.  * ** Initialise the extension.
  */  */
Line 2183 
Line 2415 
     SyncReqCode = extEntry->base;     SyncReqCode = extEntry->base;
     SyncEventBase = extEntry->eventBase;     SyncEventBase = extEntry->eventBase;
     SyncErrorBase = extEntry->errorBase;     SyncErrorBase = extEntry->errorBase;
     EventSwapVector[SyncEventBase + XSyncCounterNotify] = SCounterNotifyEvent;      EventSwapVector[SyncEventBase + XSyncCounterNotify] = (EventSwapPtr) SCounterNotifyEvent;
     EventSwapVector[SyncEventBase + XSyncAlarmNotify] = SAlarmNotifyEvent;      EventSwapVector[SyncEventBase + XSyncAlarmNotify] = (EventSwapPtr) SAlarmNotifyEvent;
  
     /*     /*
      * Although SERVERTIME is implemented by the OS layer, we initialise it      * Although SERVERTIME is implemented by the OS layer, we initialise it


Legend:
Removed from v.3.0  
changed lines
  Added in v.3.1

Powered by
ViewCVS 0.9.2