| 1 | package SPVM::UV::Handle::Idle; | ||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | 1; | ||
| 6 | |||
| 7 | =encoding utf8 | ||
| 8 | |||
| 9 | =head1 Name | ||
| 10 | |||
| 11 | SPVM::UV::Handle::Idle - Idle Handle for libuv | ||
| 12 | |||
| 13 | =head1 Description | ||
| 14 | |||
| 15 | C<UV::Handle::Idle> in L<SPVM> represents the idle handle for L<libuv|https://libuv.org/>, corresponding to the C<uv_idle_t> structure. | ||
| 16 | |||
| 17 | =head1 Super Class | ||
| 18 | |||
| 19 | L<UV::Handle|SPVM::UV::Handle> | ||
| 20 | |||
| 21 | =head1 Usage | ||
| 22 | |||
| 23 | use UV::Handle::Idle; | ||
| 24 | |||
| 25 | my $idle = UV::Handle::Idle->new; | ||
| 26 | |||
| 27 | =head1 Fields | ||
| 28 | |||
| 29 | =head2 idle_cb | ||
| 30 | |||
| 31 | C<has idle_cb : rw L<UV::Callback::Idle|SPVM::UV::Callback::Idle>;> | ||
| 32 | |||
| 33 | The callback called when the idle handle is active. | ||
| 34 | |||
| 35 | =head1 Class Methods | ||
| 36 | |||
| 37 | =head2 new | ||
| 38 | |||
| 39 | C<static method new : L<UV::Handle::Idle|SPVM::UV::Handle::Idle> ();> | ||
| 40 | |||
| 41 | Creates a new L<UV::Handle::Idle|SPVM::UV::Handle::Idle> object, and returns it. | ||
| 42 | |||
| 43 | =head1 Instance Methods | ||
| 44 | |||
| 45 | =head2 start | ||
| 46 | |||
| 47 | C<method start : void ($cb : L<UV::Callback::Idle|SPVM::UV::Callback::Idle>);> | ||
| 48 | |||
| 49 | Starts the idle handle with the callback C<$cb>. | ||
| 50 | |||
| 51 | The callback C<$cb> is stored in L</"idle_cb"> field. | ||
| 52 | |||
| 53 | The callback C<$cb> is invoked when the idle handle is active. | ||
| 54 | |||
| 55 | This method calls the L<uv_idle_start|https://docs.libuv.org/en/v1.x/idle.html#c.uv_idle_start> function. | ||
| 56 | |||
| 57 | Exceptions: | ||
| 58 | |||
| 59 | If $cb is not defined, an exception is thrown. | ||
| 60 | |||
| 61 | If uv_idle_start fails, an exception is thrown. | ||
| 62 | |||
| 63 | =head2 stop | ||
| 64 | |||
| 65 | C<method stop : void ();> | ||
| 66 | |||
| 67 | Stops the idle handle. | ||
| 68 | |||
| 69 | This method calls the L<uv_idle_stop|https://docs.libuv.org/en/v1.x/idle.html#c.uv_idle_stop> function. | ||
| 70 | |||
| 71 | Exceptions: | ||
| 72 | |||
| 73 | If uv_idle_stop fails, an exception is thrown. | ||
| 74 | |||
| 75 | =head1 Copyright & License | ||
| 76 | |||
| 77 | Copyright (c) 2026 Yuki Kimoto | ||
| 78 | |||
| 79 | MIT License |