DbEnv::set_isalive()
Prev | Chapter 5. The DbEnv Handle | Next

## DbEnv::set_isalive()

    #include <db_cxx.h>

    int
    DbEnv::set_isalive(int (*is_alive)(DbEnv *dbenv, pid_t pid,
        db_threadid_t tid, u_int32_t flags));

Declare a function that returns if a thread of control (either a true thread or a process) is still running. The `DbEnv::set_isalive()` method supports the DbEnv::failchk() method. For more information, see Architecting Data Store and Concurrent Data Store applications, and Architecting Transactional Data Store applications, both in the Berkeley DB Programmer's Reference Guide.

The `DbEnv::set_isalive()` method configures operations performed using the specified DbEnv handle, not all operations performed on the underlying database environment.

The `DbEnv::set_isalive()` method may be called at any time during the life of the application.

The `DbEnv::set_isalive()` method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.

### Parameters

#### is_alive

The is_alive parameter is a function which returns non-zero if the thread of control, identified by the pid and tid arguments, is still running. The function takes four arguments:

- dbenv

  The dbenv parameter is the enclosing database environment handle, allowing application access to the application-private fields of that object.

- pid

  The pid parameter is a process ID returned by the function specified to the DbEnv::set_thread_id() method.

- tid

  The tid parameter is a thread ID returned by the function specified to the DbEnv::set_thread_id() method.

- flags

  The flags parameter must be set to 0 or the following value:

  - `DB_MUTEX_PROCESS_ONLY`

    Return only if the process is alive, the thread ID should be ignored.

### Errors

The `DbEnv::set_isalive()` method may fail and throw a DbException exception, encapsulating one of the following non-zero errors, or return one of the following non-zero errors:

#### EINVAL

An invalid flag value or parameter was specified.

### Class

DbEnv

### See Also

Database Environments and Related Methods

Prev | Up | Next
DbEnv::set_intermediate_dir_mode() | Home | DbEnv::set_message_stream()