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