summaryrefslogtreecommitdiff
path: root/docs/gsg_txn/CXX/txnexample_c.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/gsg_txn/CXX/txnexample_c.html')
-rw-r--r--docs/gsg_txn/CXX/txnexample_c.html23
1 files changed, 11 insertions, 12 deletions
diff --git a/docs/gsg_txn/CXX/txnexample_c.html b/docs/gsg_txn/CXX/txnexample_c.html
index a6005e46..83a3f9f5 100644
--- a/docs/gsg_txn/CXX/txnexample_c.html
+++ b/docs/gsg_txn/CXX/txnexample_c.html
@@ -14,7 +14,7 @@
<body>
<div xmlns="" class="navheader">
<div class="libver">
- <p>Library Version 11.2.5.3</p>
+ <p>Library Version 12.1.6.1</p>
</div>
<table width="100%" summary="Navigation header">
<tr>
@@ -93,7 +93,7 @@ extern int getopt(int, char * const *, const char *);
<pre class="programlisting">// Printing of pthread_t is implementation-specific, so we
// create our own thread IDs for reporting purposes.
int global_thread_num;
-pthread_mutex_t thread_num_lock;
+mutex_t thread_num_lock;
// Forward declarations
int countRecords(Db *, DbTxn *);
@@ -124,7 +124,7 @@ main(int argc, char *argv[])
Db *dbp = NULL;
DbEnv *envp = NULL;
- pthread_t writerThreads[NUMWRITERS];
+ thread_t writerThreads[NUMWRITERS];
int ch, i;
u_int32_t envFlags;
char *dbHomeDir;
@@ -237,16 +237,16 @@ The implementation of <code class="function">open_db()</code> is described
thread.
</p>
<pre class="programlisting"> // Initialize a pthread mutex. Used to help provide thread ids.
- (void)pthread_mutex_init(&amp;thread_num_lock, NULL);
+ (void)mutex_init(&amp;thread_num_lock, NULL);
// Start the writer threads.
for (i = 0; i &lt; NUMWRITERS; i++)
- (void)pthread_create(&amp;writerThreads[i], NULL,
+ (void)thread_create(&amp;writerThreads[i], NULL,
writerThread, (void *)dbp);
// Join the writers
for (i = 0; i &lt; NUMWRITERS; i++)
- (void)pthread_join(writerThreads[i], NULL);
+ (void)thread_join(writerThreads[i], NULL);
} catch(DbException &amp;e) {
std::cerr &lt;&lt; "Error opening database environment: "
@@ -320,13 +320,13 @@ writerThread(void *args)
We use this random number generator for data generation.
</p>
<pre class="programlisting"> // Get the thread number
- (void)pthread_mutex_lock(&amp;thread_num_lock);
+ (void)mutex_lock(&amp;thread_num_lock);
global_thread_num++;
thread_num = global_thread_num;
- (void)pthread_mutex_unlock(&amp;thread_num_lock);
+ (void)mutex_unlock(&amp;thread_num_lock);
// Initialize the random number generator
- srand((u_int)pthread_self()); </pre>
+ srand(thread_num); </pre>
<p>
Now we begin the loop that we use to write data to the database.
@@ -387,8 +387,7 @@ writerThread(void *args)
for (j = 0; j &lt; 10; j++) {
Dbt key, value;
key.set_data(key_strings[j]);
- key.set_size((strlen(key_strings[j]) + 1) *
- sizeof(char));
+ key.set_size((u_int32_t)strlen(key_strings[j]) + 1);
int payload = rand() + i;
value.set_data(&amp;payload);
@@ -653,7 +652,7 @@ openDb(Db **dbpp, const char *progname, const char *fileName,
experiment with this code, you can find the example in the following
location in your DB distribution:
</p>
- <pre class="programlisting"><span class="emphasis"><em>DB_INSTALL</em></span>/examples_cxx/txn_guide</pre>
+ <pre class="programlisting"><span class="emphasis"><em>DB_INSTALL</em></span>/examples/cxx/txn_guide</pre>
</div>
<div class="navfooter">
<hr />