diff options
author | Alex Gorrod <alexander.gorrod@mongodb.com> | 2017-06-14 19:39:53 +0000 |
---|---|---|
committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2017-06-14 19:39:53 +0000 |
commit | 11ca50ae96399aa8b0eaeee5dc115398d78fee2b (patch) | |
tree | a54af4da3e0dc8f216c191ce23e650e318ce00ac /src/third_party/wiredtiger/test/thread | |
parent | a16bc9371921766d41e7a86c3ca10080c677ce6d (diff) | |
download | mongo-11ca50ae96399aa8b0eaeee5dc115398d78fee2b.tar.gz |
Import wiredtiger: 47e8c3d1d22018eaaa09f91dfd78addb49e0b49b from branch mongodb-3.6
ref: 7aaeaaa054..47e8c3d1d2
for: 3.5.9
WT-2596 Document behavior after a crash with a backup cursor open
WT-3169 Add ability to log a message when the lookaside file is used
WT-3326 workgen: run wtperf "runner" files
WT-3332 Add statistic tracking connection wide transaction conflicts
WT-3346 workgen: create JSON output for latency sampling
WT-3349 Add timing stats to rwlocks
WT-3361 Resolve Windows build warnings, build more test programs on Windows.
WT-3362 Cursor opens should never block for the duration of a checkpoint
WT-3369 WT_CURSOR->uri should always match the URI used to open the cursor
Diffstat (limited to 'src/third_party/wiredtiger/test/thread')
-rw-r--r-- | src/third_party/wiredtiger/test/thread/rw.c | 35 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/thread/t.c | 3 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/thread/thread.h | 2 |
3 files changed, 16 insertions, 24 deletions
diff --git a/src/third_party/wiredtiger/test/thread/rw.c b/src/third_party/wiredtiger/test/thread/rw.c index cbbd806c559..3283f780b32 100644 --- a/src/third_party/wiredtiger/test/thread/rw.c +++ b/src/third_party/wiredtiger/test/thread/rw.c @@ -29,8 +29,8 @@ #include "thread.h" static void print_stats(u_int); -static void *reader(void *); -static void *writer(void *); +static WT_THREAD_RET reader(void *); +static WT_THREAD_RET writer(void *); typedef struct { char *name; /* object name */ @@ -45,15 +45,13 @@ typedef struct { static INFO *run_info; -int +void rw_start(u_int readers, u_int writers) { struct timeval start, stop; + wt_thread_t *tids; double seconds; - pthread_t *tids; u_int i, name_index, offset, total_nops; - int ret; - void *thread_ret; tids = NULL; /* Keep GCC 4.1 happy. */ total_nops = 0; @@ -109,18 +107,15 @@ rw_start(u_int readers, u_int writers) /* Create threads. */ for (i = 0; i < readers; ++i) - if ((ret = pthread_create( - &tids[i], NULL, reader, (void *)(uintptr_t)i)) != 0) - testutil_die(ret, "pthread_create"); - for (; i < readers + writers; ++i) { - if ((ret = pthread_create( - &tids[i], NULL, writer, (void *)(uintptr_t)i)) != 0) - testutil_die(ret, "pthread_create"); - } + testutil_check(__wt_thread_create( + NULL, &tids[i], reader, (void *)(uintptr_t)i)); + for (; i < readers + writers; ++i) + testutil_check(__wt_thread_create( + NULL, &tids[i], writer, (void *)(uintptr_t)i)); /* Wait for the threads. */ for (i = 0; i < readers + writers; ++i) - (void)pthread_join(tids[i], &thread_ret); + testutil_check(__wt_thread_join(NULL, tids[i])); (void)gettimeofday(&stop, NULL); seconds = (stop.tv_sec - start.tv_sec) + @@ -147,8 +142,6 @@ rw_start(u_int readers, u_int writers) free(run_info); free(tids); - - return (0); } /* @@ -186,7 +179,7 @@ reader_op(WT_SESSION *session, WT_CURSOR *cursor, INFO *s) * reader -- * Reader thread start function. */ -static void * +static WT_THREAD_RET reader(void *arg) { INFO *s; @@ -234,7 +227,7 @@ reader(void *arg) printf(" read thread %2d stopping: tid: %s, file: %s\n", id, tid, s->name); - return (NULL); + return (WT_THREAD_RET_VALUE); } /* @@ -291,7 +284,7 @@ writer_op(WT_SESSION *session, WT_CURSOR *cursor, INFO *s) * writer -- * Writer thread start function. */ -static void * +static WT_THREAD_RET writer(void *arg) { INFO *s; @@ -339,7 +332,7 @@ writer(void *arg) printf("write thread %2d stopping: tid: %s, file: %s\n", id, tid, s->name); - return (NULL); + return (WT_THREAD_RET_VALUE); } /* diff --git a/src/third_party/wiredtiger/test/thread/t.c b/src/third_party/wiredtiger/test/thread/t.c index 4b767e7f476..c6ff9a95145 100644 --- a/src/third_party/wiredtiger/test/thread/t.c +++ b/src/third_party/wiredtiger/test/thread/t.c @@ -160,8 +160,7 @@ main(int argc, char *argv[]) wt_connect(config_open); /* WiredTiger connection */ - if (rw_start(readers, writers)) /* Loop operations */ - return (EXIT_FAILURE); + rw_start(readers, writers); /* Loop operations */ stats(); /* Statistics */ diff --git a/src/third_party/wiredtiger/test/thread/thread.h b/src/third_party/wiredtiger/test/thread/thread.h index 86b1b55a30e..bcba442b4c1 100644 --- a/src/third_party/wiredtiger/test/thread/thread.h +++ b/src/third_party/wiredtiger/test/thread/thread.h @@ -46,6 +46,6 @@ extern int vary_nops; /* Operations per thread */ extern int session_per_op; /* New session per operation */ void load(const char *); -int rw_start(u_int, u_int); +void rw_start(u_int, u_int); void stats(void); void verify(const char *); |