Skip to content

Commit

Permalink
fix code (#5576)
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFreeman authored Nov 21, 2024
1 parent af29dac commit 2e662ed
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 82 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PROJECT(libswoole)
cmake_minimum_required(VERSION 2.8.12)

ENABLE_LANGUAGE(ASM)
set(SWOOLE_VERSION 6.0.0-dev)
set(SWOOLE_VERSION 6.0.0RC1)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -g")
Expand Down
32 changes: 20 additions & 12 deletions ext-src/php_swoole_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
+----------------------------------------------------------------------+
*/

/* $Id: 6f6113a57c450c84e00246f2d3c15cf1e7f1f692 */
/* $Id: 1bb86a633f720da45a4d4347f23ff7755c968221 */

#ifndef SWOOLE_LIBRARY_H
#define SWOOLE_LIBRARY_H
Expand Down Expand Up @@ -97,9 +97,11 @@ static const char* swoole_library_source_std_exec =
"\n"
"declare(strict_types=1);\n"
"\n"
"use Swoole\\Coroutine\\System;\n"
"\n"
"function swoole_exec(string $command, &$output = null, &$returnVar = null)\n"
"{\n"
" $result = Swoole\\Coroutine::exec($command);\n"
" $result = System::exec($command);\n"
" if ($result) {\n"
" $outputList = explode(PHP_EOL, $result['output']);\n"
" foreach ($outputList as &$value) {\n"
Expand All @@ -122,7 +124,7 @@ static const char* swoole_library_source_std_exec =
"\n"
"function swoole_shell_exec(string $cmd)\n"
"{\n"
" $result = Swoole\\Coroutine::exec($cmd);\n"
" $result = System::exec($cmd);\n"
" if ($result && $result['output'] !== '') {\n"
" return $result['output'];\n"
" }\n"
Expand Down Expand Up @@ -259,6 +261,10 @@ static const char* swoole_library_source_core_constant =
"\n"
" public const OPTION_IOURING_ENTRIES = 'iouring_entries';\n"
"\n"
" public const OPTION_IOURING_WORKERS = 'iouring_workers';\n"
"\n"
" public const OPTION_IOURING_FLAG = 'iouring_flag';\n"
"\n"
" public const OPTION_ENABLE_SIGNALFD = 'enable_signalfd';\n"
"\n"
" public const OPTION_WAIT_SIGNAL = 'wait_signal';\n"
Expand Down Expand Up @@ -3716,9 +3722,9 @@ static const char* swoole_library_source_core_curl_handler =
"\n"
"namespace Swoole\\Curl;\n"
"\n"
"use Swoole;\n"
"use Swoole\\Constant;\n"
"use Swoole\\Coroutine\\Http\\Client;\n"
"use Swoole\\Coroutine\\System;\n"
"use Swoole\\Curl\\Exception as CurlException;\n"
"use Swoole\\Http\\Status;\n"
"\n"
Expand Down Expand Up @@ -4420,7 +4426,7 @@ static const char* swoole_library_source_core_curl_handler =
" }\n"
"\n"
" if (!filter_var($proxy, FILTER_VALIDATE_IP)) {\n"
" $ip = Swoole\\Coroutine::gethostbyname($proxy, AF_INET, $this->clientOptions['connect_timeout'] ?? -1);\n"
" $ip = System::gethostbyname($proxy, AF_INET, $this->clientOptions['connect_timeout'] ?? -1);\n"
" if (!$ip) {\n"
" $this->setError(CURLE_COULDNT_RESOLVE_PROXY, 'Could not resolve proxy: ' . $proxy);\n"
" return false;\n"
Expand Down Expand Up @@ -9186,6 +9192,7 @@ static const char* swoole_library_source_core_thread_pool =
" private object $running;\n"
"\n"
" private object $queue;\n"
"\n"
" private array $indexes = [];\n"
"\n"
" public function __construct(string $runnableClass, int $threadNum)\n"
Expand All @@ -9197,7 +9204,7 @@ static const char* swoole_library_source_core_thread_pool =
" $this->threadNum = $threadNum;\n"
" }\n"
"\n"
" public function withArguments(array $arguments): static\n"
" public function withArguments(...$arguments): static\n"
" {\n"
" $this->arguments = $arguments;\n"
" return $this;\n"
Expand All @@ -9218,7 +9225,7 @@ static const char* swoole_library_source_core_thread_pool =
" /**\n"
" * @throws \\ReflectionException\n"
" */\n"
" public function start(array $arguments = []): void\n"
" public function start(): void\n"
" {\n"
" if (empty($this->classDefinitionFile) and class_exists($this->runnableClass, false)) {\n"
" $file = (new \\ReflectionClass($this->runnableClass))->getFileName();\n"
Expand Down Expand Up @@ -9283,11 +9290,11 @@ static const char* swoole_library_source_core_thread_pool =
"\n"
" while ($this->running->get()) {\n"
" $threadId = $this->queue->pop(-1);\n"
" $thread = $this->threads[$threadId];\n"
" $index = $this->indexes[$threadId];\n"
" $thread = $this->threads[$threadId];\n"
" $index = $this->indexes[$threadId];\n"
" $thread->join();\n"
" unset($this->threads[$threadId]);\n"
" unset($this->indexes[$threadId]);\n"
" unset($this->threads[$threadId], $this->indexes[$threadId]);\n"
"\n"
" $this->createThread($index);\n"
" }\n"
"\n"
Expand Down Expand Up @@ -9370,12 +9377,13 @@ static const char* swoole_library_source_core_thread_runnable =
"abstract class Runnable\n"
"{\n"
" protected Atomic $running;\n"
"\n"
" protected int $id;\n"
"\n"
" public function __construct($running, $index)\n"
" {\n"
" $this->running = $running;\n"
" $this->id = $index;\n"
" $this->id = $index;\n"
" }\n"
"\n"
" abstract public function run(array $args): void;\n"
Expand Down
4 changes: 2 additions & 2 deletions include/swoole_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#define SWOOLE_MAJOR_VERSION 6
#define SWOOLE_MINOR_VERSION 0
#define SWOOLE_RELEASE_VERSION 0
#define SWOOLE_EXTRA_VERSION "dev"
#define SWOOLE_VERSION "6.0.0-dev"
#define SWOOLE_EXTRA_VERSION ""
#define SWOOLE_VERSION "6.0.0RC1"
#define SWOOLE_VERSION_ID 60000
#define SWOOLE_API_VERSION_ID 0x202208a

Expand Down
Loading

0 comments on commit 2e662ed

Please sign in to comment.