[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Log meaningful messages before failing on windows with threadlocal.
commit 087cf882c6a9ef6b9617d21ef26c19c47a4fc660
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Tue Aug 18 08:37:15 2015 -0400
Log meaningful messages before failing on windows with threadlocal.
---
src/common/compat_winthreads.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/common/compat_winthreads.c b/src/common/compat_winthreads.c
index 3d9e236..381e338 100644
--- a/src/common/compat_winthreads.c
+++ b/src/common/compat_winthreads.c
@@ -139,14 +139,30 @@ tor_threadlocal_destroy(tor_threadlocal_t *threadlocal)
void *
tor_threadlocal_get(tor_threadlocal_t *threadlocal)
{
- return TlsGetValue(threadlocal->index);
+ void *value = TlsGetValue(threadlocal->index);
+ if (value == NULL) {
+ DWORD err = GetLastError();
+ if (err != ERROR_SUCCESS) {
+ char *msg = format_win32_error(err);
+ log_err(LD_GENERAL, "Error retrieving thread-local value: %s", msg);
+ tor_free(msg);
+ tor_assert(err == ERROR_SUCCESS);
+ }
+ }
+ return value;
}
void
tor_threadlocal_set(tor_threadlocal_t *threadlocal, void *value)
{
BOOL ok = TlsSetValue(threadlocal->index, value);
- tor_assert(ok);
+ if (!ok) {
+ DWORD err = GetLastError();
+ char *msg = format_win32_error(err);
+ log_err(LD_GENERAL, "Error adjusting thread-local value: %s", msg);
+ tor_free(msg);
+ tor_assert(ok);
+ }
}
int
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits