PHP 4.0 Bug #4827: Have flock accept LOCK_* instead of 1, 2 ...
| From: | juhl at eisenstein dot dk | Date: | Mon, 05 Jun 2000 15:48:08 +0000 |
| Subject: | PHP 4.0 Bug #4827: Have flock accept LOCK_* instead of 1, 2 ... | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-20254@lists.php.net to get a copy of this message | ||
From: juhl@eisenstein.dk
Operating system: Linux
PHP version: 4.0.0 Release
PHP Bug Type: Feature/Change Request
Bug description: Have flock accept LOCK_* instead of 1, 2 ...
What I'd like to see is for flock() to accept the constants LOCK_SH, LOCK_EX, LOCK_UN and
LOCK_NB instead of 1, 2, 3, +4 - this is similar to how the C function behaves and makes it possible
for the creators of PHP to change the values used for the different functions without affecting
scripts.
Using the values 1, 2, 3, +4 is (IMHO) a mess and will lead to problems sooner or later when flock()
has to be changed.
For those who do not know the C flock() function here's the meaning of the constants:
LOCK_SH = Shared lock
LOCK_EX = Exclusive lock
LOCK_UN = Unlock
LOCK_NB = Don't block when locking
It would also be nice if flock() could return EWOULDBLOCK or something simmilar if nonblocking
operation was requested, but the function would block. Currently there's no way to distinguish
between a failed call and a call that would have blocked (in both cases false is returned).