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

 ID:                 74120
 Updated by:         [email protected]
 Reported by:        amancio at prjc dot com dot br
 Summary:            SyncEvent fires only when someone is waiting
-Status:             Open
+Status:             Assigned
 Type:               Bug
 Package:            PECL
 Operating System:   Linux
 PHP Version:        5.6.30
 Block user comment: N
 Private report:     N

 New Comment:

Thanks for the bug report and test case.  Looks like a probable regression in 
manual reset event objects.  I'll look into this.

Note that any bugs in the PECL package will almost always reflect over here:

https://github.com/cubiclesoft/cross-platform-cpp

Version 1.1.0 represents a major rewrite to bypass POSIX semaphore issues on 
some platforms (e.g. Mac) and added support for PHP 7.  Windows saw no 
significant changes other than PHP 7 support.  That at least explains why any 
regressions took place.


Previous Comments:
------------------------------------------------------------------------
[2017-02-17 13:58:25] amancio at prjc dot com dot br

Description:
------------
Using package 'sync' PECL extension;

When an instance of SyncEvent calls fire() in a thread, the other instance of 
SyncEvent just gets fired if it is executing wait(). If the thread is 
processing other things, the next call to wait() will wait indefinitely.

This bad behaviour was observed just on Linux with sync 1.1.0. On Windows, sync 
1.1.0 behaves correctly (the next call to wait() knows the event was already 
fired). Sync 1.0.1 (the previous version) behaves correctly on both platforms, 
Windows and Linux.

Test script:
---------------
// a single-threaded example:
$event = new SyncEvent("Test-123", true);
$event->fire();
if ($event->wait(0))
  echo "Fired, ok";
else
  echo "Not fired?";

Expected result:
----------------
On any platform, any version should have to print "Fired, ok".

Actual result:
--------------
On Windows, Sync 1.0.1 and 1.1.0 prints "Fired, ok".
On Linux, Sync 1.0.1 prints "Fired, ok", but Sync 1.1.0 prints "Not fired?".


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



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

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

Reply via email to