DbEnv::set_thread_id_string()

#include <db_cxx>

int
DbEnv::set_thread_id(void (*thread_id)
                     (DbEnv *dbenv, pid_t *pid, db_threadid_t *tid)); 

Declare a function that formats a process ID and thread ID identifier pair for display into a caller-supplied buffer. The function must return a reference to the caller-specified buffer. The DbEnv::set_thread_id_string() method supports the DbEnv::set_thread_id() method.

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

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

The DbEnv::set_thread_id_string() 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

thread_id_string

The thread_id_string parameter is a function which returns a buffer in which is an identifier pair formatted for display. 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 argument is a process ID.

  • tid

    The tid argument is a thread ID.

  • buf

    The buf argument is character array of at least DB_THREADID_STRLEN bytes in length, into which the identifier pair should be formatted.

If no thread_id_string function is specified, the default routine displays the identifier pair as "pid/tid", that is, the process ID represented as an unsigned integer value, a slash ('/') character, then the thread ID represented as an unsigned integer value.

Errors

The DbEnv::set_thread_id_string() 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