ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.3
(Generate patch)

Comparing libev/ev.3 (file contents):
Revision 1.125 by sf-exg, Sun May 14 19:02:31 2023 UTC vs.
Revision 1.126 by root, Sat Jun 3 08:53:03 2023 UTC

1.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) 1.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43)
2.\" 2.\"
3.\" Standard preamble: 3.\" Standard preamble:
4.\" ======================================================================== 4.\" ========================================================================
5.de Sp \" Vertical space (when we can't use .PP) 5.de Sp \" Vertical space (when we can't use .PP)
6.if t .sp .5v 6.if t .sp .5v
131.\} 131.\}
132.rm #[ #] #H #V #F C 132.rm #[ #] #H #V #F C
133.\" ======================================================================== 133.\" ========================================================================
134.\" 134.\"
135.IX Title "LIBEV 3" 135.IX Title "LIBEV 3"
136.TH LIBEV 3 "2021-01-11" "libev-4.33" "libev - high performance full featured event loop" 136.TH LIBEV 3 "2023-05-15" "libev-4.33" "libev - high performance full featured event loop"
137.\" For nroff, turn off justification. Always turn off hyphenation; it makes 137.\" For nroff, turn off justification. Always turn off hyphenation; it makes
138.\" way too many mistakes in technical documents. 138.\" way too many mistakes in technical documents.
139.if n .ad l 139.if n .ad l
140.nh 140.nh
141.SH "NAME" 141.SH "NAME"
801and is not embeddable, which would limit the usefulness of this backend 801and is not embeddable, which would limit the usefulness of this backend
802immensely. 802immensely.
803.ie n .IP """EVBACKEND_PORT"" (value 32, Solaris 10)" 4 803.ie n .IP """EVBACKEND_PORT"" (value 32, Solaris 10)" 4
804.el .IP "\f(CWEVBACKEND_PORT\fR (value 32, Solaris 10)" 4 804.el .IP "\f(CWEVBACKEND_PORT\fR (value 32, Solaris 10)" 4
805.IX Item "EVBACKEND_PORT (value 32, Solaris 10)" 805.IX Item "EVBACKEND_PORT (value 32, Solaris 10)"
806This uses the Solaris 10 event port mechanism. As with everything on Solaris, 806This uses the Solaris 10 event port mechanism. As with everything on
807it's really slow, but it still scales very well (O(active_fds)). 807Solaris, it's really slow, but it still scales very well (O(active_fds)).
808.Sp 808.Sp
809While this backend scales well, it requires one system call per active 809While this backend scales well, it requires one system call per active
810file descriptor per loop iteration. For small and medium numbers of file 810file descriptor per loop iteration. For small and medium numbers of file
811descriptors a \*(L"slow\*(R" \f(CW\*(C`EVBACKEND_SELECT\*(C'\fR or \f(CW\*(C`EVBACKEND_POLL\*(C'\fR backend 811descriptors a \*(L"slow\*(R" \f(CW\*(C`EVBACKEND_SELECT\*(C'\fR or \f(CW\*(C`EVBACKEND_POLL\*(C'\fR backend
812might perform better. 812might perform better.
1533.IP "bool ev_is_active (ev_TYPE *watcher)" 4 1533.IP "bool ev_is_active (ev_TYPE *watcher)" 4
1534.IX Item "bool ev_is_active (ev_TYPE *watcher)" 1534.IX Item "bool ev_is_active (ev_TYPE *watcher)"
1535Returns a true value iff the watcher is active (i.e. it has been started 1535Returns a true value iff the watcher is active (i.e. it has been started
1536and not yet been stopped). As long as a watcher is active you must not modify 1536and not yet been stopped). As long as a watcher is active you must not modify
1537it unless documented otherwise. 1537it unless documented otherwise.
1538.Sp
1539Obviously, it is safe to call this on an active watcher, or actually any
1540watcher that is initialised.
1538.IP "bool ev_is_pending (ev_TYPE *watcher)" 4 1541.IP "bool ev_is_pending (ev_TYPE *watcher)" 4
1539.IX Item "bool ev_is_pending (ev_TYPE *watcher)" 1542.IX Item "bool ev_is_pending (ev_TYPE *watcher)"
1540Returns a true value iff the watcher is pending, (i.e. it has outstanding 1543Returns a true value iff the watcher is pending, (i.e. it has outstanding
1541events but its callback has not yet been invoked). As long as a watcher 1544events but its callback has not yet been invoked). As long as a watcher
1542is pending (but not active) you must not call an init function on it (but 1545is pending (but not active) you must not call an init function on it (but
1543\&\f(CW\*(C`ev_TYPE_set\*(C'\fR is safe), you must not change its priority, and you must 1546\&\f(CW\*(C`ev_TYPE_set\*(C'\fR is safe), you must not change its priority, and you must
1544make sure the watcher is available to libev (e.g. you cannot \f(CW\*(C`free ()\*(C'\fR 1547make sure the watcher is available to libev (e.g. you cannot \f(CW\*(C`free ()\*(C'\fR
1545it). 1548it).
1549.Sp
1550It is safe to call this on any watcher in any state as long as it is
1551initialised.
1546.IP "callback ev_cb (ev_TYPE *watcher)" 4 1552.IP "callback ev_cb (ev_TYPE *watcher)" 4
1547.IX Item "callback ev_cb (ev_TYPE *watcher)" 1553.IX Item "callback ev_cb (ev_TYPE *watcher)"
1548Returns the callback currently set on the watcher. 1554Returns the callback currently set on the watcher.
1549.IP "ev_set_cb (ev_TYPE *watcher, callback)" 4 1555.IP "ev_set_cb (ev_TYPE *watcher, callback)" 4
1550.IX Item "ev_set_cb (ev_TYPE *watcher, callback)" 1556.IX Item "ev_set_cb (ev_TYPE *watcher, callback)"
1563from being executed (except for \f(CW\*(C`ev_idle\*(C'\fR watchers). 1569from being executed (except for \f(CW\*(C`ev_idle\*(C'\fR watchers).
1564.Sp 1570.Sp
1565If you need to suppress invocation when higher priority events are pending 1571If you need to suppress invocation when higher priority events are pending
1566you need to look at \f(CW\*(C`ev_idle\*(C'\fR watchers, which provide this functionality. 1572you need to look at \f(CW\*(C`ev_idle\*(C'\fR watchers, which provide this functionality.
1567.Sp 1573.Sp
1568You \fImust not\fR change the priority of a watcher as long as it is active or 1574You \fImust not\fR change the priority of a watcher as long as it is active
1569pending. 1575or pending. Reading the priority with \f(CW\*(C`ev_priority\*(C'\fR is fine in any state.
1570.Sp 1576.Sp
1571Setting a priority outside the range of \f(CW\*(C`EV_MINPRI\*(C'\fR to \f(CW\*(C`EV_MAXPRI\*(C'\fR is 1577Setting a priority outside the range of \f(CW\*(C`EV_MINPRI\*(C'\fR to \f(CW\*(C`EV_MAXPRI\*(C'\fR is
1572fine, as long as you do not mind that the priority value you query might 1578fine, as long as you do not mind that the priority value you query might
1573or might not have been clamped to the valid range. 1579or might not have been clamped to the valid range.
1574.Sp 1580.Sp
1593callback to be invoked, which can be accomplished with this function. 1599callback to be invoked, which can be accomplished with this function.
1594.IP "ev_feed_event (loop, ev_TYPE *watcher, int revents)" 4 1600.IP "ev_feed_event (loop, ev_TYPE *watcher, int revents)" 4
1595.IX Item "ev_feed_event (loop, ev_TYPE *watcher, int revents)" 1601.IX Item "ev_feed_event (loop, ev_TYPE *watcher, int revents)"
1596Feeds the given event set into the event loop, as if the specified event 1602Feeds the given event set into the event loop, as if the specified event
1597had happened for the specified watcher (which must be a pointer to an 1603had happened for the specified watcher (which must be a pointer to an
1598initialised but not necessarily started event watcher). Obviously you must 1604initialised but not necessarily started event watcher, though it can be
1599not free the watcher as long as it has pending events. 1605active). Obviously you must not free the watcher as long as it has pending
1606events.
1600.Sp 1607.Sp
1601Stopping the watcher, letting libev invoke it, or calling 1608Stopping the watcher, letting libev invoke it, or calling
1602\&\f(CW\*(C`ev_clear_pending\*(C'\fR will clear the pending event, even if the watcher was 1609\&\f(CW\*(C`ev_clear_pending\*(C'\fR will clear the pending event, even if the watcher was
1603not started in the first place. 1610not started in the first place.
1604.Sp 1611.Sp
1625\&\f(CW\*(C`ev_TYPE_init\*(C'\fR again. 1632\&\f(CW\*(C`ev_TYPE_init\*(C'\fR again.
1626.IP "started/running/active" 4 1633.IP "started/running/active" 4
1627.IX Item "started/running/active" 1634.IX Item "started/running/active"
1628Once a watcher has been started with a call to \f(CW\*(C`ev_TYPE_start\*(C'\fR it becomes 1635Once a watcher has been started with a call to \f(CW\*(C`ev_TYPE_start\*(C'\fR it becomes
1629property of the event loop, and is actively waiting for events. While in 1636property of the event loop, and is actively waiting for events. While in
1630this state it cannot be accessed (except in a few documented ways), moved, 1637this state it cannot be accessed (except in a few documented ways, such as
1631freed or anything else \- the only legal thing is to keep a pointer to it, 1638stoping it), moved, freed or anything else \- the only legal thing is to
1632and call libev functions on it that are documented to work on active watchers. 1639keep a pointer to it, and call libev functions on it that are documented
1640to work on active watchers.
1641.Sp
1642As a rule of thumb, before accessing a member or calling any function on
1643a watcher, it should be stopped (or freshly initialised). If that is not
1644convenient, you can check the documentation for that function or member to
1645see if it is safe to use on an active watcher.
1633.IP "pending" 4 1646.IP "pending" 4
1634.IX Item "pending" 1647.IX Item "pending"
1635If a watcher is active and libev determines that an event it is interested 1648If a watcher is active and libev determines that an event it is interested
1636in has occurred (such as a timer expiring), it will become pending. It will 1649in has occurred (such as a timer expiring), it will become pending. It
1637stay in this pending state until either it is stopped or its callback is 1650will stay in this pending state until either it is explicitly stopped or
1638about to be invoked, so it is not normally pending inside the watcher 1651its callback is about to be invoked, so it is not normally pending inside
1639callback. 1652the watcher callback.
1640.Sp 1653.Sp
1641The watcher might or might not be active while it is pending (for example, 1654Generally, the watcher might or might not be active while it is pending
1642an expired non-repeating timer can be pending but no longer active). If it 1655(for example, an expired non-repeating timer can be pending but no longer
1643is stopped, it can be freely accessed (e.g. by calling \f(CW\*(C`ev_TYPE_set\*(C'\fR), 1656active). If it is pending but not active, it can be freely accessed (e.g.
1644but it is still property of the event loop at this time, so cannot be 1657by calling \f(CW\*(C`ev_TYPE_set\*(C'\fR), but it is still property of the event loop at
1645moved, freed or reused. And if it is active the rules described in the 1658this time, so cannot be moved, freed or reused. And if it is active the
1646previous item still apply. 1659rules described in the previous item still apply.
1660.Sp
1661Explicitly stopping a watcher will also clear the pending state
1662unconditionally, so it is safe to stop a watcher and then free it.
1647.Sp 1663.Sp
1648It is also possible to feed an event on a watcher that is not active (e.g. 1664It is also possible to feed an event on a watcher that is not active (e.g.
1649via \f(CW\*(C`ev_feed_event\*(C'\fR), in which case it becomes pending without being 1665via \f(CW\*(C`ev_feed_event\*(C'\fR), in which case it becomes pending without being
1650active. 1666active.
1651.IP "stopped" 4 1667.IP "stopped" 4

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines