Library Version 18.1.40

db_env_set_func_yield
Prev | Appendix C. Berkeley DB Application Space Static Functions | Next

## db_env_set_func_yield

    #include <db.h>

    int
    db_env_set_func_yield(int (*func_yield)(u_long secs, u_long usecs));

The Berkeley DB library requires the ability to yield the processor from the current thread of control to any other waiting threads of control.

The func_yield function must be able to cause the rescheduling of all participants in the current Berkeley DB environment, whether threaded or not. It may be incorrect to supply a thread yield function if more than a single process is operating in the Berkeley DB environment. This is because many thread-yield functions will not allow other processes to run, and the contested lock may be held by another process, not by another thread.

The `db_env_set_func_yield()` function configures all operations performed by a process and all of its threads of control, not operations confined to a single database environment.

Although the `db_env_set_func_yield()` function may be called at any time during the life of the application, it should normally be called before making calls to the db_env_create or db_create methods.

The `db_env_set_func_yield()` function returns a non-zero error value on failure and 0 on success.

### Parameters

#### func_yield

The func_yield parameter is the function which yields the processor.

The secs parameter is the number of seconds to pause before the thread of control should run again, or 0.

The usecs parameter is the number of microseconds to pause before the thread of control should run again, or 0.

The func_yield function must return the value of errno on failure and 0 on success.

### See Also

Run-time configuration

Prev | Up | Next
db_env_set_func_write | Home | Appendix D. DB_CONFIG Parameter Reference