Edit report at https://bugs.php.net/bug.php?id=75327&edit=1

 ID:                 75327
 Updated by:         cu...@php.net
 Reported by:        zhangsy at 1pei dot com dot cn
 Summary:            PECL sync readerwriter lock problem
 Status:             Feedback
 Type:               Bug
 Package:            PECL
 Operating System:   centos 6.2
 PHP Version:        7.1.10
 Block user comment: N
 Private report:     N

 New Comment:

As the author of the extension, I agree.  The first write lock call fails 
because there is still a read lock.  The second write lock call succeeds since 
there are no read locks.  The third write lock call fails since there is 
already a write lock.

The test suite is carefully calibrated to cover the widest range of 
locking/unlocking scenarios with as little code as possible within a single 
process space (i.e. if something is locked, then it will not wait and will 
immediately return false).  Are you encountering a test suite validation error 
when running the tests?


Previous Comments:
------------------------------------------------------------------------
[2017-10-06 12:56:24] requi...@php.net

No? The first writelock was denied because there was still a readlock in place.

var_dump($readwrite->readlock(0));   // shared lock #1 - true
var_dump($readwrite->readlock(0));   // shared lock #2 - true
var_dump($readwrite->readunlock());  // unlocked #2 - true
var_dump($readwrite->writelock(0));  // still locked by #1 - false <<<
var_dump($readwrite->readunlock());  // unlock #1 - true
var_dump($readwrite->readunlock());  // not locked - false
var_dump($readwrite->writelock(0));  // exclusive lock #1 - true
var_dump($readwrite->writelock(0));  // locked by #1 - false
var_dump($readwrite->readlock(0));   // locked by #1 - false
var_dump($readwrite->writeunlock()); // unlock #1 - true

------------------------------------------------------------------------
[2017-10-06 12:49:44] zhangsy at 1pei dot com dot cn

update package to PECL sync

------------------------------------------------------------------------
[2017-10-06 12:43:15] zhangsy at 1pei dot com dot cn

Description:
------------
In the tests\014.phpt, the last fourth expect result should be bool(false), not 
bool(true), because the fourth writelock has not unlocked.

        var_dump($readwrite->readlock(0));
        var_dump($readwrite->readlock(0));
        var_dump($readwrite->readunlock());
        var_dump($readwrite->writelock(0));
        var_dump($readwrite->readunlock());
        var_dump($readwrite->readunlock());
        var_dump($readwrite->writelock(0));
        var_dump($readwrite->writelock(0));
        var_dump($readwrite->readlock(0));
        var_dump($readwrite->writeunlock());
?>
--EXPECT--
bool(true)
bool(true)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true) <----Here should be false
bool(false)
bool(false)
bool(true)



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=75327&edit=1

-- 
PECL development discussion Mailing List (http://pecl.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to