Skip to content

Commit 726b569

Browse files
committed
documentation updates
Signed-off-by: Demin Yin <deminy@deminy.net>
1 parent e6fdcc4 commit 726b569

File tree

2 files changed

+54
-6
lines changed

2 files changed

+54
-6
lines changed

src/swoole/Swoole/Table.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,20 @@ class Table implements \Iterator, \Countable
2020
{
2121
public const TYPE_INT = 1;
2222

23-
public const TYPE_STRING = 3;
24-
2523
public const TYPE_FLOAT = 2;
2624

25+
public const TYPE_STRING = 3;
26+
27+
/**
28+
* Maximum number of rows in the table.
29+
*/
2730
public int $size;
2831

2932
public int $memorySize;
3033

34+
/**
35+
* @param int $table_size Maximum number of rows in the table.
36+
*/
3137
public function __construct(int $table_size, float $conflict_proportion = 0.2)
3238
{
3339
}
@@ -104,6 +110,11 @@ public function decr(string $key, string $column, int|float $incrby = 1): int|fl
104110
{
105111
}
106112

113+
/**
114+
* Get maximum number of rows in the table.
115+
*
116+
* @return int Returns maximum number of rows in the table.
117+
*/
107118
public function getSize(): int
108119
{
109120
}

src/swoole/constants.php

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@
238238
define('SWOOLE_LOG_ERROR', 5);
239239
define('SWOOLE_LOG_NONE', 6);
240240

241+
// Log rotation intervals.
241242
define('SWOOLE_LOG_ROTATION_SINGLE', 0);
242243
define('SWOOLE_LOG_ROTATION_MONTHLY', 1);
243244
define('SWOOLE_LOG_ROTATION_DAILY', 2);
@@ -257,11 +258,31 @@
257258

258259
// limit
259260
define('SWOOLE_IOV_MAX', 1024);
261+
262+
/*
263+
* Types of supported locks in Swoole.
264+
*
265+
* @see \Swoole\Lock
266+
*/
267+
#ifdef HAVE_RWLOCK
268+
define('SWOOLE_RWLOCK', 1);
269+
#endif
260270
define('SWOOLE_FILELOCK', 2);
261271
define('SWOOLE_MUTEX', 3);
262272
define('SWOOLE_SEM', 4);
263-
define('SWOOLE_RWLOCK', 1);
273+
#ifdef HAVE_SPINLOCK
264274
define('SWOOLE_SPINLOCK', 5);
275+
#endif
276+
277+
/*
278+
* Following SIG_* and PRIO_* constants are set only when PHP extension pcntl (to support Process Control) is not installed.
279+
*
280+
* Most constants here are the same as those defined in PHP extension pcntl, as you can see from the following links:
281+
* - https://www.php.net/manual/en/pcntl.constants.php
282+
* - https://github.com/php/php-src/blob/php-8.1.12/ext/pcntl/pcntl.c#L106
283+
*/
284+
// SIG_* constants. Please see your systems signal(7) man page for details of the default behavior of these signals.
285+
define('SIG_IGN', 1);
265286
define('SIGHUP', 1);
266287
define('SIGINT', 2);
267288
define('SIGQUIT', 3);
@@ -299,19 +320,35 @@
299320
#ifdef SIGSYS
300321
define('SIGSYS', 31);
301322
#endif
302-
define('SIG_IGN', 1);
323+
/*
324+
* PRIO_* constants. They are used to get/set process priority.
325+
*
326+
* Please see your systems getpriority(2) or setpriority(2) man page for details of these constants.
327+
*
328+
* @see \Swoole\Process::getPriority()
329+
* @see \Swoole\Process::setPriority()
330+
*/
303331
define('PRIO_PROCESS', 0);
304332
define('PRIO_PGRP', 1);
305333
define('PRIO_USER', 2);
334+
306335
define('SWOOLE_DEFAULT_MAX_CORO_NUM', 100000);
307336
define('SWOOLE_CORO_MAX_NUM_LIMIT', 9223372036854775807);
308337
define('SWOOLE_CORO_INIT', 0);
309338
define('SWOOLE_CORO_WAITING', 1);
310339
define('SWOOLE_CORO_RUNNING', 2);
311340
define('SWOOLE_CORO_END', 3);
312341

313-
define('SWOOLE_EXIT_IN_COROUTINE', 2);
314-
define('SWOOLE_EXIT_IN_SERVER', 4);
342+
/*
343+
* Exit flags.
344+
*
345+
* When exit() is called in Swoole illegally, Swoole throws out a \Swoole\ExitException exception, with exit flags set
346+
* on property $flags.
347+
*
348+
* @see \Swoole\ExitException::$flags
349+
*/
350+
define('SWOOLE_EXIT_IN_COROUTINE', 2); // PHP function exit() is called inside a coroutine.
351+
define('SWOOLE_EXIT_IN_SERVER', 4); // PHP function exit() is called after Swoole server is started.
315352

316353
/*
317354
* Error codes of channels. They are used in method \Swoole\Coroutine\Channel::push() and \Swoole\Coroutine\Channel::pop() only.

0 commit comments

Comments
 (0)