1<!--$Id: env_set_thread_id_string.so,v 10.2 2007/09/26 15:11:30 bostic Exp $--> 2<!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> 3<!--See the file LICENSE for redistribution information.--> 4<html> 5<head> 6<title>Berkeley DB: DbEnv::set_thread_id_string</title> 7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> 8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> 9</head> 10<body bgcolor=white> 11<table width="100%"><tr valign=top> 12<td> 13<b>DbEnv::set_thread_id_string</b> 14</td> 15<td align=right> 16<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a> 17<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td> 18</tr></table> 19<hr size=1 noshade> 20<tt> 21<b><pre> 22#include <db_cxx.h> 23<p> 24int 25DbEnv::set_thread_id(char *(*thread_id_string)(DbEnv *dbenv, 26 pid_t pid, db_threadid_t tid, char *buf)); 27</pre></b> 28<hr size=1 noshade> 29<b>Description: DbEnv::set_thread_id_string</b> 30<p>Declare a function that formats a process ID and thread ID identifier 31pair for display into a caller-supplied buffer. The function must 32return a reference to the caller-specified buffer. The 33DbEnv::set_thread_id_string method supports the 34<a href="../api_cxx/env_set_thread_id.html">DbEnv::set_thread_id</a> method.</p> 35<p>The DbEnv::set_thread_id_string method configures operations performed using the specified 36<a href="../api_cxx/env_class.html">DbEnv</a> handle, not all operations performed on the underlying 37database environment.</p> 38<p>The DbEnv::set_thread_id_string method may be called at any time during the life of the 39application.</p> 40<p>The DbEnv::set_thread_id_string method 41either returns a non-zero error value 42or throws an exception that encapsulates a non-zero error value on 43failure, and returns 0 on success. 44</p> 45<b>Parameters</b> <br> 46 <b>thread_id_string</b><ul compact><li>The <b>thread_id_string</b> parameter is a function which returns a 47buffer in which is an identifier pair formatted for display. The 48function takes four arguments:</ul> 49<br> 50<b><b>dbenv</b></b><ul compact><li>The <b>dbenv</b> parameter is the enclosing database environment 51handle, allowing application access to the application-private fields 52of that object.</ul> 53<b><b>pid</b></b><ul compact><li>The <b>pid</b> argument is a process ID.</ul> 54<b><b>tid</b></b><ul compact><li>The <b>tid</b> argument is a thread ID.</ul> 55<b><b>buf</b></b><ul compact><li><a name="2"><!--meow--></a> 56The <b>buf</b> argument is character array of at least 57DB_THREADID_STRLEN bytes in length, into which the identifier 58pair should be formatted.</ul> 59<br> 60<br> 61<p>If no <b>thread_id_string</b> function is specified, the default 62routine displays the identifier pair as "pid/tid", that is, the process 63ID represented as an unsigned integer value, a slash ('/') character, 64then the thread ID represented as an unsigned integer value.</p> 65<br><b>Errors</b> 66<p>The DbEnv::set_thread_id_string method 67may fail and throw 68<a href="../api_cxx/except_class.html">DbException</a>, 69encapsulating one of the following non-zero errors, or return one of 70the following non-zero errors:</p> 71<br> 72<b>EINVAL</b><ul compact><li>An 73invalid flag value or parameter was specified.</ul> 74<br> 75<hr size=1 noshade> 76<br><b>Class</b> 77<a href="../api_cxx/env_class.html">DbEnv</a> 78<br><b>See Also</b> 79<a href="../api_cxx/env_list.html">Database Environments and Related Methods</a> 80</tt> 81<table width="100%"><tr><td><br></td><td align=right> 82<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a> 83</td></tr></table> 84<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 85</body> 86</html> 87