httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <>
Subject possible APIs for no-wait APR locks
Date Mon, 19 Jun 2000 19:28:24 GMT
All of the underlying lock mechanisms used by APR support no-wait
locks, but APR doesn't expose this functionality.  I'd like to get
this implemented, as it is helpful for something I wanted to play
with.  (I could hack something up pretty quickly, but I think other
folks could use it so I'd rather spend the time now getting it in
APR than hacking around with the current code, only to throw it away

Here are a few possibilities for API changes.  I prefer plan a.  I
have no preference among b and c.  Other ideas?

plan a:

  ap_create_lock() interface unchanged

  ap_lock() interface unchanged

  add new ap_set_lock_nowait() function
  (ap_set_lock_wait() could possibly be added in the future if
  somebody needs it)

plan b:

  add new lock type parameter APR_MUTEX_NOWAIT to ap_create_lock();
  APR_MUTEX is exactly like APR_MUTEX except that all ap_lock() calls
  are no-wait

  (By the way... what the heck is APR_READWRITE supposed to be?  One
  caller of ap_create_lock() specifies it, but the implementation is
  the same.)

plan c:

  add new function ap_try_lock() which is a no-wait flavor of

  This is nice, but the logic to check the current blocking state of
  the lock file (fcntl() and flock()) and possibly toggle it would be
  intermingled with the locking code.

Jeff Trawick | | PGP public key at web site:
          Born in Roswell... married an alien...

View raw message