14
14
+----------------------------------------------------------------------+
15
15
*/
16
16
17
- /* $Id: 6f6113a57c450c84e00246f2d3c15cf1e7f1f692 */
17
+ /* $Id: 1bb86a633f720da45a4d4347f23ff7755c968221 */
18
18
19
19
#ifndef SWOOLE_LIBRARY_H
20
20
#define SWOOLE_LIBRARY_H
@@ -97,9 +97,11 @@ static const char* swoole_library_source_std_exec =
97
97
"\n"
98
98
"declare(strict_types=1);\n"
99
99
"\n"
100
+ "use Swoole\\Coroutine\\System;\n"
101
+ "\n"
100
102
"function swoole_exec(string $command, &$output = null, &$returnVar = null)\n"
101
103
"{\n"
102
- " $result = Swoole\\Coroutine ::exec($command);\n"
104
+ " $result = System ::exec($command);\n"
103
105
" if ($result) {\n"
104
106
" $outputList = explode(PHP_EOL, $result['output']);\n"
105
107
" foreach ($outputList as &$value) {\n"
@@ -122,7 +124,7 @@ static const char* swoole_library_source_std_exec =
122
124
"\n"
123
125
"function swoole_shell_exec(string $cmd)\n"
124
126
"{\n"
125
- " $result = Swoole\\Coroutine ::exec($cmd);\n"
127
+ " $result = System ::exec($cmd);\n"
126
128
" if ($result && $result['output'] !== '') {\n"
127
129
" return $result['output'];\n"
128
130
" }\n"
@@ -259,6 +261,10 @@ static const char* swoole_library_source_core_constant =
259
261
"\n"
260
262
" public const OPTION_IOURING_ENTRIES = 'iouring_entries';\n"
261
263
"\n"
264
+ " public const OPTION_IOURING_WORKERS = 'iouring_workers';\n"
265
+ "\n"
266
+ " public const OPTION_IOURING_FLAG = 'iouring_flag';\n"
267
+ "\n"
262
268
" public const OPTION_ENABLE_SIGNALFD = 'enable_signalfd';\n"
263
269
"\n"
264
270
" public const OPTION_WAIT_SIGNAL = 'wait_signal';\n"
@@ -3716,9 +3722,9 @@ static const char* swoole_library_source_core_curl_handler =
3716
3722
"\n"
3717
3723
"namespace Swoole\\Curl;\n"
3718
3724
"\n"
3719
- "use Swoole;\n"
3720
3725
"use Swoole\\Constant;\n"
3721
3726
"use Swoole\\Coroutine\\Http\\Client;\n"
3727
+ "use Swoole\\Coroutine\\System;\n"
3722
3728
"use Swoole\\Curl\\Exception as CurlException;\n"
3723
3729
"use Swoole\\Http\\Status;\n"
3724
3730
"\n"
@@ -4420,7 +4426,7 @@ static const char* swoole_library_source_core_curl_handler =
4420
4426
" }\n"
4421
4427
"\n"
4422
4428
" if (!filter_var($proxy, FILTER_VALIDATE_IP)) {\n"
4423
- " $ip = Swoole\\Coroutine ::gethostbyname($proxy, AF_INET, $this->clientOptions['connect_timeout'] ?? -1);\n"
4429
+ " $ip = System ::gethostbyname($proxy, AF_INET, $this->clientOptions['connect_timeout'] ?? -1);\n"
4424
4430
" if (!$ip) {\n"
4425
4431
" $this->setError(CURLE_COULDNT_RESOLVE_PROXY, 'Could not resolve proxy: ' . $proxy);\n"
4426
4432
" return false;\n"
@@ -9186,6 +9192,7 @@ static const char* swoole_library_source_core_thread_pool =
9186
9192
" private object $running;\n"
9187
9193
"\n"
9188
9194
" private object $queue;\n"
9195
+ "\n"
9189
9196
" private array $indexes = [];\n"
9190
9197
"\n"
9191
9198
" public function __construct(string $runnableClass, int $threadNum)\n"
@@ -9197,7 +9204,7 @@ static const char* swoole_library_source_core_thread_pool =
9197
9204
" $this->threadNum = $threadNum;\n"
9198
9205
" }\n"
9199
9206
"\n"
9200
- " public function withArguments(array $arguments): static\n"
9207
+ " public function withArguments(... $arguments): static\n"
9201
9208
" {\n"
9202
9209
" $this->arguments = $arguments;\n"
9203
9210
" return $this;\n"
@@ -9218,7 +9225,7 @@ static const char* swoole_library_source_core_thread_pool =
9218
9225
" /**\n"
9219
9226
" * @throws \\ReflectionException\n"
9220
9227
" */\n"
9221
- " public function start(array $arguments = [] ): void\n"
9228
+ " public function start(): void\n"
9222
9229
" {\n"
9223
9230
" if (empty($this->classDefinitionFile) and class_exists($this->runnableClass, false)) {\n"
9224
9231
" $file = (new \\ReflectionClass($this->runnableClass))->getFileName();\n"
@@ -9283,11 +9290,11 @@ static const char* swoole_library_source_core_thread_pool =
9283
9290
"\n"
9284
9291
" while ($this->running->get()) {\n"
9285
9292
" $threadId = $this->queue->pop(-1);\n"
9286
- " $thread = $this->threads[$threadId];\n"
9287
- " $index = $this->indexes[$threadId];\n"
9293
+ " $thread = $this->threads[$threadId];\n"
9294
+ " $index = $this->indexes[$threadId];\n"
9288
9295
" $thread->join();\n"
9289
- " unset($this->threads[$threadId]);\n"
9290
- " unset($this->indexes[$threadId]); \n"
9296
+ " unset($this->threads[$threadId], $this->indexes[$threadId] );\n"
9297
+ "\n"
9291
9298
" $this->createThread($index);\n"
9292
9299
" }\n"
9293
9300
"\n"
@@ -9370,12 +9377,13 @@ static const char* swoole_library_source_core_thread_runnable =
9370
9377
"abstract class Runnable\n"
9371
9378
"{\n"
9372
9379
" protected Atomic $running;\n"
9380
+ "\n"
9373
9381
" protected int $id;\n"
9374
9382
"\n"
9375
9383
" public function __construct($running, $index)\n"
9376
9384
" {\n"
9377
9385
" $this->running = $running;\n"
9378
- " $this->id = $index;\n"
9386
+ " $this->id = $index;\n"
9379
9387
" }\n"
9380
9388
"\n"
9381
9389
" abstract public function run(array $args): void;\n"
0 commit comments