@@ -3455,7 +3455,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
34553455 void *stack,
34563456 size_t stacksize,
34573457 ACE_Base_Thread_Adapter *thread_adapter,
3458- const char ** thr_name)
3458+ const char ** thr_name)
34593459{
34603460 ACE_OS_TRACE (" ACE_OS::thr_create" );
34613461
@@ -3882,6 +3882,11 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
38823882 flags,
38833883 thr_id);
38843884
3885+ if (thr_name && *thr_name && *thr_handle)
3886+ {
3887+ SetThreadDescription (*thr_handle, ACE_Ascii_To_Wide (*thr_name).wchar_rep ());
3888+ }
3889+
38853890 if (priority != ACE_DEFAULT_THREAD_PRIORITY && *thr_handle != 0 )
38863891 {
38873892 // Set the priority of the new thread and then let it
@@ -3937,7 +3942,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
39373942 // The call below to ::taskSpawn () causes VxWorks to assign a
39383943 // unique task name of the form: "t" + an integer, because the
39393944 // first argument is 0.
3940- tid = ::taskSpawn (thr_name && *thr_name ? const_cast <char *> (*thr_name) : 0 ,
3945+ tid = ::taskSpawn (thr_name && *thr_name ? const_cast <char *> (*thr_name) : 0 ,
39413946 priority,
39423947 (int ) flags,
39433948 stacksize,
@@ -3957,7 +3962,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
39573962
39583963 // The TID is defined to be the address of the TCB.
39593964 int status = ::taskInit (tcb,
3960- thr_name && *thr_name ? const_cast <char *> (*thr_name) : 0 ,
3965+ thr_name && *thr_name ? const_cast <char *> (*thr_name) : 0 ,
39613966 priority,
39623967 (int ) flags,
39633968 (char *) stack + sizeof (WIND_TCB),
@@ -4023,17 +4028,20 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
40234028
40244029 // Don't let this Task run immediately; we have to set its entrypoint's argument below.
40254030 err_code = ::SetupTask (AddressSpaceObjectNumber (1 ), priority /* priority */ , 0 /* weight */ , 0 /* timeslice */ ,
4026- (Address) stack /* stack */ , (Address) stacksize /* stackLength */ , true /* enableClibrary */ ,
4027- true /* allocTLS */ , (Address) &integrity_task_adapter, false /* startIt */ , 0 /* name */ ,
4028- 0 /* symbolFile */ , thr_handle /* newTask */ , 0 /* newActivity */ );
4031+ (Address) stack /* stack */ , (Address) stacksize /* stackLength */ , true /* enableClibrary */ ,
4032+ true /* allocTLS */ , (Address) &integrity_task_adapter, false /* startIt */ ,
4033+ thr_name ? const_cast <char *> (*thr_name) : nullptr /* name */ ,
4034+ 0 /* symbolFile */ , thr_handle /* newTask */ , 0 /* newActivity */ );
40294035
40304036# else
40314037 ACE_UNUSED_ARG (stack);
40324038 // INTEGRITY has kernel calls in which we can pass argument for the new Task's entry point,
40334039 // e.g. CommonCreateTaskWithArgument.
40344040 // However, we are imitating INTEGRITY-178 and the call without entrypoint's argument is used.
40354041 err_code = ::CommonCreateTask (priority, (Address) &integrity_task_adapter /* entrypoint */ ,
4036- (Address) stacksize, 0 /* name */ , thr_handle /* newtask */ );
4042+ (Address) stacksize,
4043+ thr_name ? const_cast <char *> (*thr_name) : nullptr /* name */ ,
4044+ thr_handle /* newtask */ );
40374045# endif
40384046
40394047 if (err_code != Success)
0 commit comments