2 .\" Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
15 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
18 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 .Nd "GEOM events management"
38 .Fn g_post_event "g_event_t *func" "void *arg" "int flag" ...
40 .Fn g_waitfor_event "g_event_t *func" "void *arg" "int flag" ...
42 .Fn g_cancel_event "void *ref"
44 The GEOM framework has its own event queue to inform classes about important
46 The event queue can be also used by GEOM classes themselves, for example
47 to work around some restrictions in the I/O path, where sleeping, heavy weight
48 tasks, etc.\& are not permitted.
52 function tells the GEOM framework to call function
61 for memory allocations inside of
63 The only allowed flags are
67 The rest of the arguments are used as references to identify the event.
68 An event can be canceled by using any of the given references as an
71 The list of references has to end with a
77 function is a blocking version of the
80 It waits until the event is finished or canceled and then returns.
84 function cancels all event(s) identified by
86 Cancellation is equivalent to calling the requested function
87 with requested arguments and argument
91 .Sh RESTRICTIONS/CONDITIONS
93 .Bl -item -offset indent
102 The list of references has to end with a
107 .Fn g_waitfor_event :
108 .Bl -item -offset indent
117 The list of references has to end with a
123 function cannot be called from an event, since doing so would result
132 return 0 if successful; otherwise an error code is returned.
134 Example of a function called from the event queue.
135 .Bd -literal -offset indent
137 example_event(void *arg, int flag)
140 if (flag == EV_CANCEL) {
141 printf("Event with argument %p canceled.\\n", arg);
145 printf("Event with argument %p called.\\n", arg);
149 Possible errors for the
158 and there was insufficient memory.
161 Possible errors for the
166 The event was canceled.
172 and there was insufficient memory.
176 .Xr DECLARE_GEOM_CLASS 9 ,
184 .Xr g_provider_by_name 9 ,
188 This manual page was written by
189 .An Pawel Jakub Dawidek Aq pjd@FreeBSD.org .