pmmpthread support

This commit is contained in:
Dylan K. Taylor
2023-05-20 01:29:26 +01:00
parent 8454076235
commit e0630fbb25
24 changed files with 159 additions and 126 deletions

View File

@ -0,0 +1,35 @@
<?php
namespace pmmp\thread;
/**
* @implements \IteratorAggregate<array-key, mixed>
*/
abstract class ThreadSafe implements \IteratorAggregate{
/**
* @template TReturn
* @param \Closure() : TReturn $function
* @param mixed ...$args
* @return TReturn
*/
public function synchronized(\Closure $function, mixed ...$args) : mixed{}
}
/**
* @template TKey of array-key
* @template TValue
* @implements \ArrayAccess<TKey, TValue>
*/
final class ThreadSafeArray extends ThreadSafe implements \Countable, \ArrayAccess{
/**
* @return TValue|null
*/
public function pop() : mixed{}
/**
* @return TValue|null
*/
public function shift() : mixed{}
}