2020-01-30 22:31:15 +00:00
|
|
|
<?php
|
|
|
|
|
2023-05-20 01:29:26 +01:00
|
|
|
namespace pmmp\thread;
|
|
|
|
|
2020-01-30 22:31:15 +00:00
|
|
|
/**
|
2023-01-23 20:02:33 +00:00
|
|
|
* @implements \IteratorAggregate<array-key, mixed>
|
2020-01-30 22:31:15 +00:00
|
|
|
*/
|
2023-05-20 01:29:26 +01:00
|
|
|
abstract class ThreadSafe implements \IteratorAggregate{
|
2023-01-23 20:02:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @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
|
2023-05-20 01:29:26 +01:00
|
|
|
* @implements \ArrayAccess<TKey, TValue>
|
2023-01-23 20:02:33 +00:00
|
|
|
*/
|
2023-05-20 01:29:26 +01:00
|
|
|
final class ThreadSafeArray extends ThreadSafe implements \Countable, \ArrayAccess{
|
2023-01-23 20:02:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return TValue|null
|
|
|
|
*/
|
|
|
|
public function pop() : mixed{}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return TValue|null
|
|
|
|
*/
|
|
|
|
public function shift() : mixed{}
|
2023-05-20 01:29:26 +01:00
|
|
|
}
|