Skip to content

Commit

Permalink
Optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Mar 21, 2024
1 parent cc47833 commit 604b35e
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 218 deletions.
1 change: 1 addition & 0 deletions examples/thread/co.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
$list = new Swoole\Thread\ArrayList();
$list[] = base64_encode(random_bytes(32));
$list[1] = uniqid();
var_dump(count($list));

$t1 = Swoole\Thread::exec('mt.php', 'thread-1', PHP_OS, $map, $list);
$t2 = Swoole\Thread::exec('mt.php', 'thread-2', PHP_OS, $map, $list);
Expand Down
2 changes: 1 addition & 1 deletion examples/thread/run_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use Swoole\Thread\Map;

$map = new Map(Map::KEY_STR);
$map = new Map;
$c = 4;
$threads = [];

Expand Down
2 changes: 1 addition & 1 deletion ext-src/stubs/php_swoole_thread.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static function getId(): int {}

namespace Swoole\Thread {
class Map implements ArrayAccess, Countable {
public function __construct(int $key_type) {}
public function __construct() {}
public function offsetGet(mixed $key): mixed {}
public function offsetExists(mixed $key): bool {}
public function offsetSet(mixed $key, mixed $value): void {}
Expand Down
6 changes: 2 additions & 4 deletions ext-src/stubs/php_swoole_thread_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 446102efcc4c1f8abfe4fdcb2be9bc9f2621f749 */
* Stub hash: 8278b4b79d73cc176a240b37d2dffe837f349eeb */

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Swoole_Thread___construct, 0, 0, 0)
ZEND_END_ARG_INFO()
Expand All @@ -22,9 +22,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Swoole_Thread_getId, 0, 0, IS_LONG, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Swoole_Thread_Map___construct, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, key_type, IS_LONG, 0)
ZEND_END_ARG_INFO()
#define arginfo_class_Swoole_Thread_Map___construct arginfo_class_Swoole_Thread___construct

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Swoole_Thread_Map_offsetGet, 0, 1, IS_MIXED, 0)
ZEND_ARG_TYPE_INFO(0, key, IS_MIXED, 0)
Expand Down
Loading

0 comments on commit 604b35e

Please sign in to comment.