mirror of
https://github.com/awslabs/aws-crt-php.git
synced 2026-08-18 01:57:13 +00:00
Unit tests and I/O bindings (#8)
* Added composer config, added IO/error tests using phpunit * Added ApiGen doc comments * Added test to ensure last_error is not set from loading up the CRT
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
require_once('crt.php');
|
||||
|
||||
final class EventLoopGroupOptions {
|
||||
/**
|
||||
* @var int $num_threads - Number of worker threads in the EventLoopGroup. Defaults to 0/1 per logical core.
|
||||
*/
|
||||
public $num_threads = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents 1 or more event loops (1 per thread) for doing I/O and background tasks.
|
||||
* Typically, every application has one EventLoopGroup.
|
||||
*/
|
||||
final class EventLoopGroup extends NativeResource {
|
||||
function __construct($options) {
|
||||
parent::__construct();
|
||||
$this->acquire(self::$crt->event_loop_group_new($options->num_threads));
|
||||
}
|
||||
|
||||
function __destruct() {
|
||||
self::$crt->event_loop_group_release($this->native);
|
||||
$this->release();
|
||||
parent::__destruct();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user