diff options
author | Keith Bostic <keith.bostic@mongodb.com> | 2016-06-23 01:21:50 -0400 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2016-06-23 15:21:50 +1000 |
commit | fef0765ef50f4407e5219c10b700bc999bb9467e (patch) | |
tree | 54a34ed53d1fa57f1d5fb7438b6bcb1d9834fa56 /src/os_win/os_thread.c | |
parent | 5d5082d1bddb2bf52aa7dc3b9f04518ac0313ca8 (diff) | |
download | mongo-fef0765ef50f4407e5219c10b700bc999bb9467e.tar.gz |
WT-2408 Windows error translation layer (#2819)
Build a Windows-to-POSIX/ANSI error translation layer.
Replace the read-only error mapping to WT_NOTFOUND and WT_PERM_DENIED
with EACCES and ENOENT.
Windows no longer needs its own version of __wt_strerror(), move the POSIX implementation from os_posix/os_errno.c to os_common/os_errno.c. Rename os_win/os_errno.c to os_win/os_winerr.c to avoid a collision.
Windows now has DWORD types in prototypes, split the Windows/POSIX extern.h files. (This actually cleans up some noise, previously we had to sort the OS prototypes to remove duplicates, which wasn't trivial.)
Add the WT_EXTENSION_API.map_windows_error method to map Windows system codes to POSIX/ANSI system codes.
Diffstat (limited to 'src/os_win/os_thread.c')
-rw-r--r-- | src/os_win/os_thread.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/os_win/os_thread.c b/src/os_win/os_thread.c index 2b846216442..a34dff776b6 100644 --- a/src/os_win/os_thread.c +++ b/src/os_win/os_thread.c @@ -31,19 +31,24 @@ __wt_thread_create(WT_SESSION_IMPL *session, int __wt_thread_join(WT_SESSION_IMPL *session, wt_thread_t tid) { - WT_DECL_RET; + DWORD windows_error; - if ((ret = WaitForSingleObject(tid, INFINITE)) != WAIT_OBJECT_0) - /* - * If we fail to wait, we will leak handles so do not continue - */ - WT_PANIC_RET(session, - ret == WAIT_FAILED ? __wt_getlasterror() : ret, - "thread join: WaitForSingleObject"); + if ((windows_error = + WaitForSingleObject(tid, INFINITE)) != WAIT_OBJECT_0) { + if (windows_error == WAIT_FAILED) + windows_error = __wt_getlasterror(); + __wt_errx(session, "thread join: WaitForSingleObject: %s", + __wt_formatmessage(session, windows_error)); + + /* If we fail to wait, we will leak handles, do not continue. */ + return (WT_PANIC); + } if (CloseHandle(tid) == 0) { - WT_RET_MSG(session, - __wt_getlasterror(), "thread join: CloseHandle"); + windows_error = __wt_getlasterror(); + __wt_errx(session, "thread join: CloseHandle: %s", + __wt_formatmessage(session, windows_error)); + return (__wt_map_windows_error(windows_error)); } return (0); |