|
238 | 238 | define('SWOOLE_LOG_ERROR', 5); |
239 | 239 | define('SWOOLE_LOG_NONE', 6); |
240 | 240 |
|
| 241 | +// Log rotation intervals. |
241 | 242 | define('SWOOLE_LOG_ROTATION_SINGLE', 0); |
242 | 243 | define('SWOOLE_LOG_ROTATION_MONTHLY', 1); |
243 | 244 | define('SWOOLE_LOG_ROTATION_DAILY', 2); |
|
257 | 258 |
|
258 | 259 | // limit |
259 | 260 | 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 |
260 | 270 | define('SWOOLE_FILELOCK', 2); |
261 | 271 | define('SWOOLE_MUTEX', 3); |
262 | 272 | define('SWOOLE_SEM', 4); |
263 | | -define('SWOOLE_RWLOCK', 1); |
| 273 | +#ifdef HAVE_SPINLOCK |
264 | 274 | 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); |
265 | 286 | define('SIGHUP', 1); |
266 | 287 | define('SIGINT', 2); |
267 | 288 | define('SIGQUIT', 3); |
|
299 | 320 | #ifdef SIGSYS |
300 | 321 | define('SIGSYS', 31); |
301 | 322 | #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 | + */ |
303 | 331 | define('PRIO_PROCESS', 0); |
304 | 332 | define('PRIO_PGRP', 1); |
305 | 333 | define('PRIO_USER', 2); |
| 334 | + |
306 | 335 | define('SWOOLE_DEFAULT_MAX_CORO_NUM', 100000); |
307 | 336 | define('SWOOLE_CORO_MAX_NUM_LIMIT', 9223372036854775807); |
308 | 337 | define('SWOOLE_CORO_INIT', 0); |
309 | 338 | define('SWOOLE_CORO_WAITING', 1); |
310 | 339 | define('SWOOLE_CORO_RUNNING', 2); |
311 | 340 | define('SWOOLE_CORO_END', 3); |
312 | 341 |
|
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. |
315 | 352 |
|
316 | 353 | /* |
317 | 354 | * Error codes of channels. They are used in method \Swoole\Coroutine\Channel::push() and \Swoole\Coroutine\Channel::pop() only. |
|
0 commit comments