1<!--$Id: mutex_set_align.so,v 10.1 2005/07/20 16:34:00 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::mutex_set_align</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::mutex_set_align</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::mutex_set_align(u_int32_t align); 26<p> 27int 28DbEnv::mutex_get_align(u_int32_t *alignp); 29</pre></b> 30<hr size=1 noshade> 31<b>Description: DbEnv::mutex_set_align</b> 32<p>Set the mutex alignment, in bytes.</p> 33<p>It is sometimes advantageous to align mutexes on specific byte 34boundaries in order to minimize cache line collisions. The 35DbEnv::mutex_set_align method specifies an alignment for mutexes allocated 36by Berkeley DB.</p> 37<p>The database environment's mutex alignment may also be configured using the 38environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file. The syntax of the entry in that 39file is a single line with the string "mutex_set_align", one or more whitespace 40characters, and the mutex alignment in bytes. 41Because the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment 42is opened, it will silently overrule configuration done before that 43time.</p> 44<p>The DbEnv::mutex_set_align method configures a database environment, not only operations 45performed using the specified <a href="../api_cxx/env_class.html">DbEnv</a> handle.</p> 46<p>The DbEnv::mutex_set_align method may not be called after the <a href="../api_cxx/env_open.html">DbEnv::open</a> method is 47called. 48If the database environment already exists when 49<a href="../api_cxx/env_open.html">DbEnv::open</a> is called, the information specified to DbEnv::mutex_set_align 50will be ignored. 51</p> 52<p>The DbEnv::mutex_set_align method 53either returns a non-zero error value 54or throws an exception that encapsulates a non-zero error value on 55failure, and returns 0 on success. 56</p> 57<b>Parameters</b> <br> 58 <b>align</b><ul compact><li>The <b>align</b> parameter is the mutex alignment, in bytes. The mutex 59alignment must be a power-of-two.</ul> 60<br> 61<br><b>Errors</b> 62<p>The DbEnv::mutex_set_align method 63may fail and throw 64<a href="../api_cxx/except_class.html">DbException</a>, 65encapsulating one of the following non-zero errors, or return one of 66the following non-zero errors:</p> 67<br> 68<b>EINVAL</b><ul compact><li>An 69invalid flag value or parameter was specified.</ul> 70<br> 71<hr size=1 noshade> 72<b>Description: DbEnv::mutex_get_align</b> 73<p>The DbEnv::mutex_get_align method returns the mutex alignment, in bytes.</p> 74<p>The DbEnv::mutex_get_align method may be called at any time during the life of the 75application.</p> 76<p>The DbEnv::mutex_get_align method 77either returns a non-zero error value 78or throws an exception that encapsulates a non-zero error value on 79failure, and returns 0 on success. 80</p> 81<b>Parameters</b> <br> 82 <b>alignp</b><ul compact><li>The DbEnv::mutex_get_align method returns the 83mutex alignment, in bytes in <b>alignp</b>.</ul> 84<br> 85<hr size=1 noshade> 86<br><b>Class</b> 87<a href="../api_cxx/env_class.html">DbEnv</a> 88<br><b>See Also</b> 89<a href="../api_cxx/env_list.html">Database Environments and Related Methods</a> 90</tt> 91<table width="100%"><tr><td><br></td><td align=right> 92<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> 93</td></tr></table> 94<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 95</body> 96</html> 97