1
<!--$Id: set_func_yield.so,v 10.11 2001/05/01 14:23:15 bostic Exp $-->
2
<!--Copyright 1997-2001 by Sleepycat Software, Inc.-->
3
<!--All rights reserved.-->
6
<title>Berkeley DB: db_env_set_func_yield</title>
7
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
11
<a name="2"><!--meow--></a>
12
<table width="100%"><tr valign=top>
14
<h1>db_env_set_func_yield</h1>
17
<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
25
db_env_set_func_yield(int (*func_yield)(void));
28
<p>The Berkeley DB library requires the ability to yield the processor from the current
29
thread of control to any other waiting threads of control.
30
The <b>func_yield</b> argument must conform to the following interface:
31
<p><blockquote><pre>int yield(void);</pre></blockquote>
32
<p>The <b>func_yield</b> function must be able to cause the rescheduling
33
of all participants in the current Berkeley DB environment, whether threaded
34
or not. It may be incorrect to supply a thread <b>yield</b> function
35
if more than a single process is operating in the Berkeley DB environment.
36
This is because many thread-yield functions will not allow other
37
processes to run, and the contested lock may be held by another process,
38
not by another thread.
39
<p>If no <b>func_yield</b> function is specified, or if the <b>yield</b>
40
function returns an error, the function specified by the
41
<a href="../api_c/set_func_sleep.html">db_env_set_func_sleep</a> entry will be used instead or subsequently;
42
that is, if no <b>yield</b> function is specified, or if it is possible
43
for the <b>yield</b> function to fail, the <b>sleep</b> function
44
<b>must</b> cause the processor to reschedule any waiting threads of
45
control for execution.
46
<p>The <b>func_yield</b> function must return the value of <b>errno</b> on
47
failure and 0 on success.
48
<p>The db_env_set_func_yield interface affects the entire application, not a single
49
database or database environment.
50
<p>Although the db_env_set_func_yield interface may be used to configure Berkeley DB at any time
51
during the life of the application, it should normally be called before
52
making any calls to the <a href="../api_c/env_create.html">db_env_create</a> or <a href="../api_c/db_create.html">db_create</a> functions.
53
<p>The db_env_set_func_yield function returns a non-zero error value on failure and 0 on success.
55
<p>The db_env_set_func_yield function may fail and return a non-zero error for the following conditions:
57
<p><dt>EINVAL<dd>An invalid flag value or parameter was specified.
59
<p>The db_env_set_func_yield function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions.
60
If a catastrophic error has occurred, the db_env_set_func_yield function may fail and return
61
<a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>, in which case all subsequent Berkeley DB calls will fail
64
<a href="../api_c/set_func_close.html">db_env_set_func_close</a>,
65
<a href="../api_c/set_func_dirfree.html">db_env_set_func_dirfree</a>,
66
<a href="../api_c/set_func_dirlist.html">db_env_set_func_dirlist</a>,
67
<a href="../api_c/set_func_exists.html">db_env_set_func_exists</a>,
68
<a href="../api_c/set_func_free.html">db_env_set_func_free</a>,
69
<a href="../api_c/set_func_fsync.html">db_env_set_func_fsync</a>,
70
<a href="../api_c/set_func_ioinfo.html">db_env_set_func_ioinfo</a>,
71
<a href="../api_c/set_func_malloc.html">db_env_set_func_malloc</a>,
72
<a href="../api_c/set_func_map.html">db_env_set_func_map</a>,
73
<a href="../api_c/set_func_open.html">db_env_set_func_open</a>,
74
<a href="../api_c/set_func_read.html">db_env_set_func_read</a>,
75
<a href="../api_c/set_func_realloc.html">db_env_set_func_realloc</a>,
76
<a href="../api_c/set_func_seek.html">db_env_set_func_seek</a>,
77
<a href="../api_c/set_func_sleep.html">db_env_set_func_sleep</a>,
78
<a href="../api_c/set_func_unlink.html">db_env_set_func_unlink</a>,
79
<a href="../api_c/set_func_unmap.html">db_env_set_func_unmap</a>,
80
<a href="../api_c/set_func_write.html">db_env_set_func_write</a>,
82
<a href="../api_c/set_func_yield.html">db_env_set_func_yield</a>.
84
<table width="100%"><tr><td><br></td><td align=right>
85
<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
87
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>