Skip to content

Commit

Permalink
update Swoole Library for v6.0.0-rc1
Browse files Browse the repository at this point in the history
Signed-off-by: Demin Yin <[email protected]>
  • Loading branch information
deminy committed Nov 29, 2024
1 parent 5e54938 commit a8a6c7e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/swoole_library/src/core/Constant.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ class Constant

public const OPTION_IOURING_ENTRIES = 'iouring_entries';

public const OPTION_IOURING_WORKERS = 'iouring_workers';

public const OPTION_IOURING_FLAG = 'iouring_flag';

public const OPTION_ENABLE_SIGNALFD = 'enable_signalfd';

public const OPTION_WAIT_SIGNAL = 'wait_signal';
Expand Down
4 changes: 2 additions & 2 deletions src/swoole_library/src/core/Curl/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

namespace Swoole\Curl;

use Swoole;
use Swoole\Constant;
use Swoole\Coroutine\Http\Client;
use Swoole\Coroutine\System;
use Swoole\Curl\Exception as CurlException;
use Swoole\Http\Status;

Expand Down Expand Up @@ -717,7 +717,7 @@ private function execute()
}

if (!filter_var($proxy, FILTER_VALIDATE_IP)) {
$ip = Swoole\Coroutine::gethostbyname($proxy, AF_INET, $this->clientOptions['connect_timeout'] ?? -1);
$ip = System::gethostbyname($proxy, AF_INET, $this->clientOptions['connect_timeout'] ?? -1);
if (!$ip) {
$this->setError(CURLE_COULDNT_RESOLVE_PROXY, 'Could not resolve proxy: ' . $proxy);
return false;
Expand Down
13 changes: 7 additions & 6 deletions src/swoole_library/src/core/Thread/Pool.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class Pool
private object $running;

private object $queue;

private array $indexes = [];

public function __construct(string $runnableClass, int $threadNum)
Expand All @@ -45,7 +46,7 @@ public function __construct(string $runnableClass, int $threadNum)
$this->threadNum = $threadNum;
}

public function withArguments(array $arguments): static
public function withArguments(...$arguments): static
{
$this->arguments = $arguments;
return $this;
Expand All @@ -66,7 +67,7 @@ public function withClassDefinitionFile(string $classDefinitionFile): static
/**
* @throws \ReflectionException
*/
public function start(array $arguments = []): void
public function start(): void
{
if (empty($this->classDefinitionFile) and class_exists($this->runnableClass, false)) {
$file = (new \ReflectionClass($this->runnableClass))->getFileName();
Expand Down Expand Up @@ -131,11 +132,11 @@ public function start(array $arguments = []): void

while ($this->running->get()) {
$threadId = $this->queue->pop(-1);
$thread = $this->threads[$threadId];
$index = $this->indexes[$threadId];
$thread = $this->threads[$threadId];
$index = $this->indexes[$threadId];
$thread->join();
unset($this->threads[$threadId]);
unset($this->indexes[$threadId]);
unset($this->threads[$threadId], $this->indexes[$threadId]);

$this->createThread($index);
}

Expand Down
3 changes: 2 additions & 1 deletion src/swoole_library/src/core/Thread/Runnable.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
abstract class Runnable
{
protected Atomic $running;

protected int $id;

public function __construct($running, $index)
{
$this->running = $running;
$this->id = $index;
$this->id = $index;
}

abstract public function run(array $args): void;
Expand Down

0 comments on commit a8a6c7e

Please sign in to comment.