2016-05-19 18:12:35 +02:00
|
|
|
<?php
|
|
|
|
|
2017-03-10 21:31:57 +01:00
|
|
|
namespace Amp\Internal;
|
2016-05-19 18:12:35 +02:00
|
|
|
|
2016-05-26 06:09:53 +02:00
|
|
|
class Watcher {
|
2017-03-10 21:58:46 +01:00
|
|
|
const DEFER = 0b00000001;
|
|
|
|
const TIMER = 0b00000110;
|
|
|
|
const DELAY = 0b00000010;
|
|
|
|
const REPEAT = 0b00000100;
|
|
|
|
const IO = 0b00011000;
|
2016-05-27 17:16:36 +02:00
|
|
|
const READABLE = 0b00001000;
|
|
|
|
const WRITABLE = 0b00010000;
|
2017-03-10 21:58:46 +01:00
|
|
|
const SIGNAL = 0b00100000;
|
2016-05-26 06:09:53 +02:00
|
|
|
|
2017-02-17 05:36:32 +01:00
|
|
|
/** @var int */
|
2016-05-26 06:09:53 +02:00
|
|
|
public $type;
|
|
|
|
|
2017-02-17 05:36:32 +01:00
|
|
|
/** @var bool */
|
2016-06-03 17:00:29 +02:00
|
|
|
public $enabled = true;
|
|
|
|
|
2017-02-17 05:36:32 +01:00
|
|
|
/** @var bool */
|
2016-06-03 17:00:29 +02:00
|
|
|
public $referenced = true;
|
|
|
|
|
2017-02-17 05:36:32 +01:00
|
|
|
/** @var string */
|
2016-05-19 18:12:35 +02:00
|
|
|
public $id;
|
|
|
|
|
2017-02-17 05:36:32 +01:00
|
|
|
/** @var callable */
|
2016-05-19 18:12:35 +02:00
|
|
|
public $callback;
|
|
|
|
|
|
|
|
/**
|
2016-06-07 07:18:59 +02:00
|
|
|
* Data provided to the watcher callback.
|
|
|
|
*
|
2016-05-19 18:12:35 +02:00
|
|
|
* @var mixed
|
|
|
|
*/
|
|
|
|
public $data;
|
|
|
|
|
|
|
|
/**
|
2016-06-07 07:18:59 +02:00
|
|
|
* Watcher-dependent value storage. Stream for IO watchers, signo for signal watchers, interval for timers.
|
|
|
|
*
|
2016-05-26 06:09:53 +02:00
|
|
|
* @var mixed
|
2016-05-19 18:12:35 +02:00
|
|
|
*/
|
2016-05-26 06:09:53 +02:00
|
|
|
public $value;
|
2016-05-19 18:12:35 +02:00
|
|
|
}
|