diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2015-02-17 17:25:57 +0000 |
|---|---|---|
| committer | <> | 2015-03-17 16:26:24 +0000 |
| commit | 780b92ada9afcf1d58085a83a0b9e6bc982203d1 (patch) | |
| tree | 598f8b9fa431b228d29897e798de4ac0c1d3d970 /examples/c/ex_rep/common/rep_common.h | |
| parent | 7a2660ba9cc2dc03a69ddfcfd95369395cc87444 (diff) | |
| download | berkeleydb-master.tar.gz | |
Diffstat (limited to 'examples/c/ex_rep/common/rep_common.h')
| -rw-r--r-- | examples/c/ex_rep/common/rep_common.h | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/examples/c/ex_rep/common/rep_common.h b/examples/c/ex_rep/common/rep_common.h index edf3b67d..8f7d1348 100644 --- a/examples/c/ex_rep/common/rep_common.h +++ b/examples/c/ex_rep/common/rep_common.h @@ -1,7 +1,7 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2015 Oracle and/or its affiliates. All rights reserved. * * $Id$ */ @@ -33,6 +33,7 @@ typedef struct { int is_master; int app_finished; int in_client_sync; + int is_repmgr; } SHARED_DATA; /* Arguments for support threads. */ @@ -41,6 +42,15 @@ typedef struct { SHARED_DATA *shared; } supthr_args; +/* + * Per-thread Replication Manager structure to associate a PERM_FAILED event + * with its originating transaction. + */ +typedef struct { + char *thread_name; + int flag; +} permfail_t; + /* Portability macros for basic threading & timing */ #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN @@ -59,6 +69,16 @@ typedef HANDLE thread_t; ((WaitForSingleObject((thr), INFINITE) == WAIT_OBJECT_0) && \ GetExitCodeThread((thr), (LPDWORD)(statusp)) ? 0 : -1) +/* Thread-specific data key for PERM_FAILED structure for Windows. */ +extern DWORD permfail_key; +/* Thread local storage routine definitions for Windows. */ +#define thread_key_create(keyp) ((*keyp = TlsAlloc()) == \ + TLS_OUT_OF_INDEXES ? (int)GetLastError() : 0) +#define thread_key_delete(key) (TlsFree(key) ? 0 : (int)GetLastError()) +#define thread_setspecific(key, value) (TlsSetValue(key, value) ? 0 : \ + (int)GetLastError()) +#define thread_getspecific(key) TlsGetValue(key) + #else /* !_WIN32 */ #include <sys/time.h> #include <pthread.h> @@ -68,6 +88,14 @@ typedef pthread_t thread_t; pthread_create((thrp), (attr), (func), (arg)) #define thread_join(thr, statusp) pthread_join((thr), (statusp)) +/* Thread-specific data key for PERM_FAILED structure for Posix. */ +extern pthread_key_t permfail_key; +/* Thread local storage routine definitions for Posix. */ +#define thread_key_create(keyp) pthread_key_create(keyp, NULL) +#define thread_key_delete(key) pthread_key_delete(key) +#define thread_setspecific(key, value) pthread_setspecific(key, value) +#define thread_getspecific(key) pthread_getspecific(key) + #endif void *checkpoint_thread __P((void *)); |
