summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hornsey <fred@hornsey.us>2019-05-02 13:59:10 -0500
committerFred Hornsey <fred@hornsey.us>2019-05-02 13:59:10 -0500
commit2eabbbe957e6bbd4b2dfe2ef7eccb966d9ed00a2 (patch)
tree19c41102e25bc9150203dfdfaf29bf5742c2ff4a
parent7c946c2ae4d161a352503b7170a1c71120cd4d9b (diff)
downloadATCD-2eabbbe957e6bbd4b2dfe2ef7eccb966d9ed00a2.tar.gz
gettid: Use ACE_NOTSUP_RETURN and other fixes
-rw-r--r--ACE/ace/OS_NS_Thread.cpp6
-rw-r--r--ACE/ace/OS_NS_Thread.h4
-rw-r--r--ACE/ace/OS_NS_Thread.inl4
3 files changed, 6 insertions, 8 deletions
diff --git a/ACE/ace/OS_NS_Thread.cpp b/ACE/ace/OS_NS_Thread.cpp
index 31d5676cd11..c83b5e17496 100644
--- a/ACE/ace/OS_NS_Thread.cpp
+++ b/ACE/ace/OS_NS_Thread.cpp
@@ -4810,12 +4810,10 @@ ACE_OS::unique_name (const void *object,
pid_t
ACE_OS::thr_gettid ()
{
-#if defined(ACE_LINUX) && defined(ACE_HAS_GETTID)
+#if defined (ACE_LINUX) && defined (ACE_HAS_GETTID)
return syscall (SYS_gettid);
-#elif !defined(ACE_HAS_OPAQUE_PTHREAD_T)
- return reinterpret_cast<pid_t> (ACE_OS::thr_self ());
#else
- return 0;
+ ACE_NOTSUP_RETURN (-1);
#endif
}
diff --git a/ACE/ace/OS_NS_Thread.h b/ACE/ace/OS_NS_Thread.h
index d1cea0f96ac..f5073d5ef85 100644
--- a/ACE/ace/OS_NS_Thread.h
+++ b/ACE/ace/OS_NS_Thread.h
@@ -1755,7 +1755,7 @@ namespace ACE_OS {
ssize_t thr_id (char buffer[], size_t buffer_length);
/**
- * For systems that support it (Only Linux as of writing), this is wrapper
+ * For systems that support it (Only Linux as of writing), this is a wrapper
* for pid_t gettid().
*
* It returns the system-wide thread id (TID) for the current thread. These
@@ -1763,7 +1763,7 @@ namespace ACE_OS {
* what is returned from thr_self(), which is an address.
*
* For older Linux (pre 2.4.11) and other systems that don't have gettid(),
- * this returns thr_self().
+ * this uses ACE_NOTSUP_RETURN (-1).
*/
pid_t thr_gettid ();
diff --git a/ACE/ace/OS_NS_Thread.inl b/ACE/ace/OS_NS_Thread.inl
index 3a260b8474f..8fa3f86f19d 100644
--- a/ACE/ace/OS_NS_Thread.inl
+++ b/ACE/ace/OS_NS_Thread.inl
@@ -3187,8 +3187,8 @@ ACE_OS::thr_id (char buffer[], size_t buffer_length)
ACE_INLINE ssize_t
ACE_OS::thr_gettid (char buffer[], size_t buffer_length)
{
- return ACE_OS::snprintf (buffer, buffer_length, "%u",
- static_cast<unsigned> (ACE_OS::thr_gettid()));
+ return ACE_OS::snprintf (buffer, buffer_length, "%d",
+ static_cast<int> (ACE_OS::thr_gettid ()));
}
ACE_INLINE ACE_thread_t