1: # include   "../ingres.h"
   2: # include   "../access.h"
   3: # include   "../lock.h"
   4: 
   5: struct lockreq  Lock;
   6: /*
   7:  *	setcsl- set a critical section lock
   8:  */
   9: setcsl(rtid)
  10: long    rtid;
  11: {
  12:     register char   *r;
  13:     register int    i;
  14: 
  15: #	ifdef xATR1
  16:     if (tTf(98,  0))
  17:         printf(" setcsl r=%s \n", locv(rtid));
  18: #	endif
  19: 
  20:     if (Alockdes < 0)
  21:         return (1);
  22:     Lock.lract = A_SLP; /* sleep while waiting on lock */
  23:     Lock.lrtype = T_CS; /* critical section lock */
  24:     Lock.lrmod = M_EXCL;    /* exclusive access */
  25:     bmove(&rtid, Lock.lrel, 4); /* copy relid */
  26:     r = Lock.lpage;
  27:     for (i = 0; i < 4; i++)
  28:             /* zero out pageid */
  29:         *r++ = 0;
  30:     i = write(Alockdes, &Lock, sizeof(struct lockreq));
  31:     return (i);
  32: }
  33: 
  34: 
  35: 
  36: /*
  37:  *	unlcs- unlock a critical section
  38:  */
  39: unlcs(rtid)
  40: long    rtid;
  41: {
  42:     register char   *r;
  43:     register int    i;
  44: 
  45: #	ifdef xATR1
  46:     if (tTf(98,  1))
  47:         printf(" unlcs r=%s \n", locv(rtid));
  48: #	endif
  49: 
  50:     if (Alockdes < 0)
  51:         return (1);
  52:     Lock.lract = A_RLS1;
  53:     Lock.lrtype = T_CS;
  54:     bmove(&rtid, Lock.lrel, 4); /* copy relation identifier */
  55:     r = Lock.lpage;
  56:     for (i = 0; i < 4; i++)
  57:             /* zero out page id */
  58:         *r++ = 0;
  59:     i = write(Alockdes, &Lock, sizeof(struct lockreq));
  60:     return (i);
  61: }

Defined functions

Defined variables

Lock defined in line 5; used 11 times
Last modified: 1995-02-19
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 599
Valid CSS Valid XHTML 1.0 Strict