File tree Expand file tree Collapse file tree 6 files changed +28
-23
lines changed
Expand file tree Collapse file tree 6 files changed +28
-23
lines changed Original file line number Diff line number Diff line change 2828
2929 - name : Configure PHP
3030 run : |
31- install-php-extensions memcached sysvsem
3231 rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
3332 php --version
3433
3736 if [ "${{ matrix.type }}" != "Phpunit" ] && [ "${{ matrix.type }}" != "StaticAnalysis" ]; then composer remove --no-interaction --no-update phpunit/phpunit ergebnis/phpunit-slow-test-detector --dev; fi
3837 if [ "${{ matrix.type }}" != "CodingStyle" ]; then composer remove --no-interaction --no-update friendsofphp/php-cs-fixer ergebnis/composer-normalize --dev; fi
3938 if [ "${{ matrix.type }}" != "StaticAnalysis" ]; then composer remove --no-interaction --no-update phpstan/\* --dev; fi
39+ composer remove --no-interaction --no-update ext-lzf ext-memcached ext-sysvsem --dev
4040 composer update --ansi --prefer-dist --no-interaction --no-progress --optimize-autoloader
4141
4242 - name : " Run tests (only for Phpunit)"
Original file line number Diff line number Diff line change 3939 "symfony/polyfill-php80" : " ^1.28"
4040 },
4141 "require-dev" : {
42+ "ext-igbinary" : " *" ,
43+ "ext-lzf" : " *" ,
4244 "ext-memcached" : " *" ,
4345 "ext-pcntl" : " *" ,
4446 "ext-pdo" : " *" ,
4547 "ext-pdo_mysql" : " *" ,
4648 "ext-pdo_sqlite" : " *" ,
49+ "ext-redis" : " *" ,
4750 "ext-sysvsem" : " *" ,
4851 "eloquent/liberator" : " ^2.0 || ^3.0" ,
4952 "ergebnis/composer-normalize" : " ^2.13" ,
6265 "suggest" : {
6366 "ext-igbinary" : " To use this library with PHP Redis igbinary serializer enabled." ,
6467 "ext-lzf" : " To use this library with PHP Redis lzf compression enabled." ,
65- "ext-pnctl " : " Enables locking with flock without busy waiting in CLI scripts." ,
68+ "ext-pcntl " : " Enables locking with flock without busy waiting in CLI scripts." ,
6669 "ext-redis" : " To use this library with the PHP Redis extension." ,
6770 "ext-sysvsem" : " Enables locking using semaphores." ,
6871 "predis/predis" : " To use this library with predis."
Original file line number Diff line number Diff line change 1414 *
1515 * You should not instantiate this class directly. Use
1616 * {@link \Malkusch\Lock\Mutex\Mutex::check()}.
17+ *
18+ * @internal
1719 */
1820class DoubleCheckedLocking
1921{
Original file line number Diff line number Diff line change 1313 */
1414class Loop
1515{
16- /**
17- * Minimum time that we want to wait, between lock checks. In micro seconds.
18- */
16+ /** Minimum time that we want to wait, between lock checks. In micro seconds. */
1917 private const MINIMUM_WAIT_US = 1e4 ; // 0.01 seconds
2018
21- /**
22- * Maximum time that we want to wait, between lock checks. In micro seconds.
23- */
19+ /** Maximum time that we want to wait, between lock checks. In micro seconds. */
2420 private const MAXIMUM_WAIT_US = 5e5 ; // 0.50 seconds
2521
2622 /** @var float The timeout in seconds */
Original file line number Diff line number Diff line change @@ -251,18 +251,20 @@ public static function provideExecutionIsSerializedWhenLockedCases(): iterable
251251 return $ lock ->popsValue ();
252252 }];
253253
254- yield 'semaphore ' => [static function () use ($ filename ): Mutex {
255- $ semaphore = sem_get (ftok ($ filename , 'b ' ));
256- self ::assertThat (
257- $ semaphore ,
258- self ::logicalOr (
259- self ::isInstanceOf (\SysvSemaphore::class),
260- new IsType (IsType::TYPE_RESOURCE )
261- )
262- );
263-
264- return new SemaphoreMutex ($ semaphore );
265- }];
254+ if (extension_loaded ('sysvsem ' )) {
255+ yield 'semaphore ' => [static function () use ($ filename ): Mutex {
256+ $ semaphore = sem_get (ftok ($ filename , 'b ' ));
257+ self ::assertThat (
258+ $ semaphore ,
259+ self ::logicalOr (
260+ self ::isInstanceOf (\SysvSemaphore::class),
261+ new IsType (IsType::TYPE_RESOURCE )
262+ )
263+ );
264+
265+ return new SemaphoreMutex ($ semaphore );
266+ }];
267+ }
266268
267269 if (getenv ('MEMCACHE_HOST ' )) {
268270 yield 'memcached ' => [static function ($ timeout ): Mutex {
Original file line number Diff line number Diff line change @@ -81,9 +81,11 @@ public static function provideMutexFactoriesCases(): iterable
8181 return $ lock ->popsValue ();
8282 }];
8383
84- yield 'SemaphoreMutex ' => [static function (): Mutex {
85- return new SemaphoreMutex (sem_get (ftok (__FILE__ , 'a ' )));
86- }];
84+ if (extension_loaded ('sysvsem ' )) {
85+ yield 'SemaphoreMutex ' => [static function (): Mutex {
86+ return new SemaphoreMutex (sem_get (ftok (__FILE__ , 'a ' )));
87+ }];
88+ }
8789
8890 yield 'SpinlockMutex ' => [static function (): Mutex {
8991 $ lock = new class ('test ' ) extends SpinlockMutex {
You can’t perform that action at this time.
0 commit comments