Skip to content

Commit fd3897e

Browse files
authored
Merge pull request #2374 from mitza-oci/a6t2-thread-names
[ACE6-TAO2] Support thread names on Windows; name the threads that TAO creates
2 parents 76558e1 + 373e5f6 commit fd3897e

19 files changed

Lines changed: 109 additions & 85 deletions

ACE/NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
USER VISIBLE CHANGES BETWEEN ACE-6.5.21 and ACE-6.5.22
22
======================================================
33

4+
. Support Linux platforms that use musl-libc instead of glibc
5+
6+
. Thread names given to ACE_OS::thr_create are now passed down to the OS
7+
on Windows.
8+
49
USER VISIBLE CHANGES BETWEEN ACE-6.5.20 and ACE-6.5.21
510
======================================================
611

ACE/ace/OS_NS_Thread.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3565,7 +3565,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
35653565
void *stack,
35663566
size_t stacksize,
35673567
ACE_Base_Thread_Adapter *thread_adapter,
3568-
const char** thr_name)
3568+
const char **thr_name)
35693569
{
35703570
ACE_OS_TRACE ("ACE_OS::thr_create");
35713571

@@ -4113,6 +4113,11 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
41134113
flags,
41144114
thr_id);
41154115

4116+
if (thr_name && *thr_name && *thr_handle)
4117+
{
4118+
SetThreadDescription (*thr_handle, ACE_Ascii_To_Wide (*thr_name).wchar_rep ());
4119+
}
4120+
41164121
if (priority != ACE_DEFAULT_THREAD_PRIORITY && *thr_handle != 0)
41174122
{
41184123
// Set the priority of the new thread and then let it
@@ -4168,7 +4173,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
41684173
// The call below to ::taskSpawn () causes VxWorks to assign a
41694174
// unique task name of the form: "t" + an integer, because the
41704175
// first argument is 0.
4171-
tid = ::taskSpawn (thr_name && *thr_name ? const_cast <char*> (*thr_name) : 0,
4176+
tid = ::taskSpawn (thr_name && *thr_name ? const_cast <char *> (*thr_name) : 0,
41724177
priority,
41734178
(int) flags,
41744179
stacksize,
@@ -4188,7 +4193,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
41884193

41894194
// The TID is defined to be the address of the TCB.
41904195
int status = ::taskInit (tcb,
4191-
thr_name && *thr_name ? const_cast <char*>(*thr_name) : 0,
4196+
thr_name && *thr_name ? const_cast <char *> (*thr_name) : 0,
41924197
priority,
41934198
(int) flags,
41944199
(char *) stack + sizeof (WIND_TCB),

ACE/ace/OS_NS_Thread.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1620,7 +1620,7 @@ namespace ACE_OS {
16201620
void *stack = 0,
16211621
size_t stacksize = ACE_DEFAULT_THREAD_STACKSIZE,
16221622
ACE_Base_Thread_Adapter *thread_adapter = 0,
1623-
const char** thr_name = 0);
1623+
const char **thr_name = 0);
16241624

16251625
ACE_NAMESPACE_INLINE_FUNCTION
16261626
int thr_equal (ACE_thread_t t1, ACE_thread_t t2);

ACE/ace/OS_NS_Thread.inl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2714,6 +2714,8 @@ ACE_OS::sigwait (sigset_t *sset, int *sig)
27142714
*sig = ::sigtimedwait (sset, 0, 0);
27152715
return *sig;
27162716
# endif /* __FreeBSD__ */
2717+
ACE_UNUSED_ARG (sset);
2718+
ACE_NOTSUP_RETURN (-1);
27172719
#else
27182720
ACE_UNUSED_ARG (sset);
27192721
ACE_UNUSED_ARG (sig);
@@ -3199,18 +3201,14 @@ ACE_OS::thr_self (void)
31993201
#endif /* ACE_HAS_THREADS */
32003202
}
32013203

3202-
ACE_INLINE const char*
3204+
ACE_INLINE const char *
32033205
ACE_OS::thr_name (void)
32043206
{
3205-
#if defined (ACE_HAS_THREADS)
3206-
#if defined (ACE_HAS_VXTHREADS)
3207+
#if defined (ACE_HAS_THREADS) && defined (ACE_HAS_VXTHREADS)
32073208
return ::taskName (ACE_OS::thr_self ());
32083209
#else
32093210
ACE_NOTSUP_RETURN (0);
32103211
#endif
3211-
#else
3212-
ACE_NOTSUP_RETURN (0);
3213-
#endif
32143212
}
32153213

32163214
ACE_INLINE void

ACE/ace/Sock_Connect.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,10 +1312,10 @@ ACE::count_interfaces (ACE_HANDLE handle, size_t &how_many)
13121312
{
13131313
#if defined (SIOCGIFNUM)
13141314
# if defined (SIOCGLIFNUM) && !defined (ACE_LACKS_STRUCT_LIFNUM)
1315-
int cmd = SIOCGLIFNUM;
1315+
ACE_IOCTL_TYPE_ARG2 cmd = SIOCGLIFNUM;
13161316
struct lifnum if_num = {AF_UNSPEC,0,0};
13171317
# else
1318-
int cmd = SIOCGIFNUM;
1318+
ACE_IOCTL_TYPE_ARG2 cmd = SIOCGIFNUM;
13191319
int if_num = 0;
13201320
# endif /* SIOCGLIFNUM */
13211321
if (ACE_OS::ioctl (handle, cmd, (caddr_t)&if_num) == -1)

ACE/ace/Stack_Trace.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,14 @@ ACE_Stack_Trace::c_str () const
5151
return &this->buf_[0];
5252
}
5353

54+
#if defined (__GLIBC__) || defined (ACE_HAS_EXECINFO_H) || defined (VXWORKS) || \
55+
(defined (ACE_WIN32) && !defined (__MINGW32__) && !defined (__BORLANDC__))
5456
static inline size_t
5557
determine_starting_frame (ssize_t initial_frame, ssize_t offset)
5658
{
5759
return ACE_MAX( initial_frame + offset, static_cast<ssize_t>(0));
5860
}
61+
#endif
5962

6063
#if defined(ACE_FACE_SAFETY_BASE) && !defined(ACE_FACE_DEV)
6164
void

ACE/ace/Thread.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ACE_Thread::spawn_n (size_t n,
1717
void *stack[],
1818
size_t stack_size[],
1919
ACE_Thread_Adapter *thread_adapter,
20-
const char* thr_name[])
20+
const char *thr_name[])
2121
{
2222
ACE_TRACE ("ACE_Thread::spawn_n");
2323
size_t i;
@@ -53,7 +53,7 @@ ACE_Thread::spawn_n (ACE_thread_t thread_ids[],
5353
size_t stack_size[],
5454
ACE_hthread_t thread_handles[],
5555
ACE_Thread_Adapter *thread_adapter,
56-
const char* thr_name[])
56+
const char *thr_name[])
5757
{
5858
ACE_TRACE ("ACE_Thread::spawn_n");
5959
size_t i = 0;

ACE/ace/Thread.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class ACE_Export ACE_Thread
8888
void *stack = 0,
8989
size_t stack_size = ACE_DEFAULT_THREAD_STACKSIZE,
9090
ACE_Thread_Adapter *thread_adapter = 0,
91-
const char** thr_name = 0);
91+
const char **thr_name = 0);
9292

9393
/**
9494
* Spawn N new threads, which execute @a func with argument @a arg (if
@@ -112,7 +112,7 @@ class ACE_Export ACE_Thread
112112
void *stack[] = 0,
113113
size_t stack_size[] = 0,
114114
ACE_Thread_Adapter *thread_adapter = 0,
115-
const char* thr_name[] = 0);
115+
const char *thr_name[] = 0);
116116

117117
/**
118118
* Spawn @a n new threads, which execute @a func with argument @a arg
@@ -142,7 +142,7 @@ class ACE_Export ACE_Thread
142142
size_t stack_size[] = 0,
143143
ACE_hthread_t thread_handles[] = 0,
144144
ACE_Thread_Adapter *thread_adapter = 0,
145-
const char* thr_name[] = 0);
145+
const char *thr_name[] = 0);
146146

147147
/**
148148
* Wait for one or more threads to exit and reap their exit status.

ACE/ace/Thread.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ ACE_Thread::spawn (ACE_THR_FUNC func,
8080
void *thr_stack,
8181
size_t thr_stack_size,
8282
ACE_Thread_Adapter *thread_adapter,
83-
const char** thr_name)
83+
const char **thr_name)
8484
{
8585
ACE_TRACE ("ACE_Thread::spawn");
8686

ACE/ace/Thread_Manager.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func,
579579
void *stack,
580580
size_t stack_size,
581581
ACE_Task_Base *task,
582-
const char** thr_name)
582+
const char **thr_name)
583583
{
584584
// First, threads created by Thread Manager should not be daemon threads.
585585
// Using assertion is probably a bit too strong. However, it helps
@@ -704,7 +704,7 @@ ACE_Thread_Manager::spawn (ACE_THR_FUNC func,
704704
int grp_id,
705705
void *stack,
706706
size_t stack_size,
707-
const char** thr_name)
707+
const char **thr_name)
708708
{
709709
ACE_TRACE ("ACE_Thread_Manager::spawn");
710710

@@ -745,7 +745,7 @@ ACE_Thread_Manager::spawn_n (size_t n,
745745
ACE_hthread_t thread_handles[],
746746
void *stack[],
747747
size_t stack_size[],
748-
const char* thr_name[])
748+
const char *thr_name[])
749749
{
750750
ACE_TRACE ("ACE_Thread_Manager::spawn_n");
751751
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
@@ -788,7 +788,7 @@ ACE_Thread_Manager::spawn_n (ACE_thread_t thread_ids[],
788788
size_t stack_size[],
789789
ACE_hthread_t thread_handles[],
790790
ACE_Task_Base *task,
791-
const char* thr_name[])
791+
const char *thr_name[])
792792
{
793793
ACE_TRACE ("ACE_Thread_Manager::spawn_n");
794794
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));

0 commit comments

Comments
 (0)