Skip to content

Commit

Permalink
document class \Swoole\Thread\Queue
Browse files Browse the repository at this point in the history
Signed-off-by: Demin Yin <deminy@deminy.net>
  • Loading branch information
deminy committed Jan 4, 2025
1 parent 86a6156 commit 2087b68
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions src/swoole/Swoole/Thread/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,54 @@
*/
final class Queue implements \Countable
{
/**
* Unblock only one of the waiting threads.
*
* This constant is used by method Queue::push() only.
*/
public const NOTIFY_ONE = 1;

/**
* Unblocks all threads currently waiting for this queue.
*
* This constant is used by method Queue::push() only.
*/
public const NOTIFY_ALL = 2;

public function __construct()
{
}

/**
* Push a value into the queue.
*
* @param mixed $value The value to push into the queue.
* @param int $notify_which How to unblock threads that are waiting on the queue. Either NOTIFY_ONE, NOTIFY_ALL, or 0 (not to notify anyone).
*/
public function push(mixed $value, int $notify_which = 0): void
{
}

/**
* Pop a value from the queue.
*
* @param float $wait The maximum time, in seconds, to wait for a value to become available in the queue.
* A value of 0 means to wait indefinitely.
* @return mixed The value removed from the queue, or null if the wait time expires and no value is available.
*/
public function pop(float $wait = 0): mixed
{
}

/**
* Clean the queue by removing all elements from it.
*/
public function clean(): void
{
}

/**
* Count the number of elements in the queue.
*
* {@inheritDoc}
* @return int The number of elements in the queue.
*/
public function count(): int
{
}
Expand Down

0 comments on commit 2087b68

Please sign in to comment.