home *** CD-ROM | disk | FTP | other *** search
/ Frostbyte's 1980s DOS Shareware Collection / floppyshareware.zip / floppyshareware / DOOG / CBASE09.ZIP / BTREE.ZIP / BTGETLCK.C < prev    next >
Text File  |  1989-08-31  |  1KB  |  45 lines

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