home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / c / cbase.zoo / btree101.zoo / btgetlck.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-20  |  1.1 KB  |  46 lines

  1. /*    Copyright (c) 1989 Citadel    */
  2. /*       All Rights Reserved        */
  3.  
  4. /* #ident    "@(#)btgetlck.c    1.4 - 90/06/20" */
  5.  
  6. /* local headers */
  7. #include "btree_.h"
  8.  
  9. /*man---------------------------------------------------------------------------
  10. NAME
  11.      btgetlck - get btree lock status
  12.  
  13. SYNOPSIS
  14.      #include <btree.h>
  15.  
  16.      int btgetlck(btp)
  17.      btree_t *btp;
  18.  
  19. DESCRIPTION
  20.      The btgetlck function reports the lock status of a btree.  The
  21.      btp argument is an open btree.  The function returns the status
  22.      of the lock currently held by the calling process.  Locks held by
  23.      other processes are not reported.
  24.  
  25.      The possible return values are:
  26.  
  27.           BT_UNLCK     btree not locked
  28.           BT_RDLCK     btree locked for reading
  29.           BT_WRLCK     btree locked for reading and writing
  30.  
  31. SEE ALSO
  32.      btlock.
  33.  
  34. ------------------------------------------------------------------------------*/
  35. int btgetlck(btp)
  36. btree_t *btp;
  37. {
  38.     if (!(btp->flags & BTLOCKS)) {
  39.         return BT_UNLCK;
  40.     } else if (btp->flags & BTWRLCK) {
  41.         return BT_WRLCK;
  42.     }
  43.  
  44.     return BT_RDLCK;
  45. }
  46.