public function __construct($thread_index)
{
$protocol_str = getenv('CLOUDI_API_INIT_PROTOCOL');
if ($protocol_str == false) {
throw new InvalidInputException();
}
$buffer_size_str = getenv('CLOUDI_API_INIT_BUFFER_SIZE');
if ($buffer_size_str == false) {
throw new InvalidInputException();
}
$this->s = fopen('php://fd/' . strval($thread_index + 3), 'rwb');
if ($protocol_str == 'tcp') {
$this->use_header = true;
} elseif ($protocol_str == 'udp') {
$this->use_header = false;
} elseif ($protocol_str == 'local') {
$this->use_header = true;
} else {
throw new InvalidInputException();
}
$this->initialization_complete = false;
$this->terminate = false;
$this->size = intval($buffer_size_str);
$this->callbacks = array();
$this->timeout_terminate = 1000;
// TIMEOUT_TERMINATE_MIN
$this->send(\Erlang\term_to_binary(new \Erlang\OtpErlangAtom('init')));
list($this->process_index, $this->process_count, $this->process_count_max, $this->process_count_min, $this->prefix, $this->timeout_initialize, $this->timeout_async, $this->timeout_sync, $this->timeout_terminate, $this->priority_default, $this->request_timeout_adjustment) = $this->poll_request(null, false);
}