mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 03:49:12 +08:00
microRTPS: client: properly set task/thread naming
This commit is contained in:
@@ -176,6 +176,10 @@ static int launch_send_thread(pthread_t &sender_thread)
|
|||||||
param.sched_priority = SCHED_PRIORITY_DEFAULT;
|
param.sched_priority = SCHED_PRIORITY_DEFAULT;
|
||||||
(void)pthread_attr_setschedparam(&sender_thread_attr, ¶m);
|
(void)pthread_attr_setschedparam(&sender_thread_attr, ¶m);
|
||||||
pthread_create(&sender_thread, &sender_thread_attr, send, nullptr);
|
pthread_create(&sender_thread, &sender_thread_attr, send, nullptr);
|
||||||
|
if (pthread_setname_np(sender_thread, "micrortps_client_send"))
|
||||||
|
{
|
||||||
|
PX4_ERR("Could not set pthread name (%d)", errno);
|
||||||
|
}
|
||||||
pthread_attr_destroy(&sender_thread_attr);
|
pthread_attr_destroy(&sender_thread_attr);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -190,6 +194,10 @@ void micrortps_start_topics(struct timespec &begin, uint64_t &total_read, uint64
|
|||||||
uint8_t topic_ID = 255;
|
uint8_t topic_ID = 255;
|
||||||
RcvTopicsPubs *pubs = new RcvTopicsPubs();
|
RcvTopicsPubs *pubs = new RcvTopicsPubs();
|
||||||
|
|
||||||
|
// Set the main task name to 'micrortps_client_rcv' in case there is
|
||||||
|
// data to receive
|
||||||
|
px4_prctl(PR_SET_NAME, "micrortps_client_rcv", px4_getpid());
|
||||||
|
|
||||||
// ucdrBuffer to deserialize using the user defined buffer
|
// ucdrBuffer to deserialize using the user defined buffer
|
||||||
ucdrBuffer reader;
|
ucdrBuffer reader;
|
||||||
ucdr_init_buffer(&reader, reinterpret_cast<uint8_t*>(data_buffer), BUFFER_SIZE);
|
ucdr_init_buffer(&reader, reinterpret_cast<uint8_t*>(data_buffer), BUFFER_SIZE);
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ int micrortps_client_main(int argc, char *argv[])
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_rtps_task = px4_task_spawn_cmd("rtps",
|
_rtps_task = px4_task_spawn_cmd("micrortps_client",
|
||||||
SCHED_DEFAULT,
|
SCHED_DEFAULT,
|
||||||
SCHED_PRIORITY_DEFAULT,
|
SCHED_PRIORITY_DEFAULT,
|
||||||
2650,
|
2650,
|
||||||
|
|||||||
Reference in New Issue
Block a user