xref: /minix/lib/libpuffs/puffs_cc.3 (revision 84d9c625)
1.\"	$NetBSD: puffs_cc.3,v 1.14 2009/04/11 16:48:53 wiz Exp $
2.\"
3.\" Copyright (c) 2007, 2008 Antti Kantee.  All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
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.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd January 28, 2008
27.Dt PUFFS_CC 3
28.Os
29.Sh NAME
30.Nm puffs_cc
31.Nd puffs continuation routines
32.Sh LIBRARY
33.Lb libpuffs
34.Sh SYNOPSIS
35.In puffs.h
36.Ft void
37.Fn puffs_cc_yield "struct puffs_cc *pcc"
38.Ft void
39.Fn puffs_cc_continue "struct puffs_cc *pcc"
40.Ft void
41.Fn puffs_cc_schedule "struct puffs_cc *pcc"
42.Ft struct puffs_cc *
43.Fn puffs_cc_getcc "struct puffs_usermount *pu"
44.Sh DESCRIPTION
45These routines are used for the cooperative multitasking suite present
46in puffs.
47.Pp
48.Bl -tag -width xxxx
49.It Fn puffs_cc_yield "pcc"
50Suspend and save the current execution context and return control
51to the previous point.
52In practice, from the file system author perspective, control returns
53back to where either the mainloop or where
54.Fn puffs_dispatch_exec
55was called from.
56.It Fn puffs_cc_continue pcc
57Will suspend current execution and return control to where it was
58before before calling
59.Fn puffs_cc_yield .
60This is rarely called directly but rather through
61.Fn puffs_dispatch_exec .
62.It Fn puffs_cc_schedule "pcc"
63Schedule a continuation.
64As opposed to
65.Fn puffs_cc_continue
66this call returns immediately.
67.Fa pcc
68will be scheduled sometime in the future.
69.It Fn puffs_cc_getcc "pu"
70Returns the current pcc or
71.Dv NULL
72if this is the main thread.
73.Em NOTE :
74The argument
75.Ar pu
76will most likely disappear at some point.
77.El
78.Pp
79Before calling
80.Fn puffs_cc_yield
81a file system will typically want to record some cookie value into its
82own internal bookkeeping.
83This cookie should be hooked to the
84.Va pcc
85so that the correct continuation can be continued when the event it
86was waiting for triggers.
87Alternatively, the
88.Xr puffs_framebuf 3
89framework and
90.Fn puffs_mainloop
91can be used for handling this automatically.
92.Sh SEE ALSO
93.Xr puffs 3 ,
94.Xr puffs_framebuf 3
95