Skip to content

Commit b01f13d

Browse files
bulislaw0xc0170
authored andcommitted
Make sure all system threads and mutexes have clear names
1 parent 05548e7 commit b01f13d

File tree

15 files changed

+34
-23
lines changed

15 files changed

+34
-23
lines changed

features/FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/arm_hal_interrupt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ static uint8_t sys_irq_disable_counter;
1212

1313
static mbed_rtos_storage_mutex_t critical_mutex;
1414
static const osMutexAttr_t critical_mutex_attr = {
15-
.name = "critical_mutex",
15+
.name = "nanostack_critical_mutex",
1616
.attr_bits = osMutexRecursive,
1717
.cb_mem = &critical_mutex,
1818
.cb_size = sizeof critical_mutex,

features/FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/arm_hal_timer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ static void timer_thread(void *arg)
3737
void platform_timer_enable(void)
3838
{
3939
static osThreadAttr_t timer_thread_attr = {0};
40+
timer_thread_attr.name = "pal_timer_thread";
4041
timer_thread_attr.stack_mem = &timer_thread_stk[0];
4142
timer_thread_attr.cb_mem = &timer_thread_tcb;
4243
timer_thread_attr.stack_size = sizeof(timer_thread_stk);

features/FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/ns_event_loop.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ static void event_loop_thread(void *arg);
1919
static uint64_t event_thread_stk[MBED_CONF_NANOSTACK_HAL_EVENT_LOOP_THREAD_STACK_SIZE/8];
2020
static mbed_rtos_storage_thread_t event_thread_tcb;
2121
static const osThreadAttr_t event_thread_attr = {
22+
.name = "nanostack_event_thread",
2223
.priority = osPriorityNormal,
2324
.stack_mem = &event_thread_stk[0],
2425
.stack_size = sizeof event_thread_stk,
@@ -28,7 +29,7 @@ static const osThreadAttr_t event_thread_attr = {
2829
static osThreadId_t event_thread_id;
2930
static mbed_rtos_storage_mutex_t event_mutex;
3031
static const osMutexAttr_t event_mutex_attr = {
31-
.name = "event_mutex",
32+
.name = "nanostack_event_mutex",
3233
.attr_bits = osMutexRecursive,
3334
.cb_mem = &event_mutex,
3435
.cb_size = sizeof event_mutex,

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_Freescale/k64f_emac.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -712,18 +712,18 @@ err_t eth_arch_enetif_init(struct netif *netif)
712712
LWIP_ASSERT("RxReadySem creation error", (err == ERR_OK));
713713

714714
#ifdef LWIP_DEBUG
715-
sys_thread_new("receive_thread", packet_rx, netif->state, DEFAULT_THREAD_STACKSIZE*5, RX_PRIORITY);
715+
sys_thread_new("k64f_emac_rx_thread", packet_rx, netif->state, DEFAULT_THREAD_STACKSIZE*5, RX_PRIORITY);
716716
#else
717-
sys_thread_new("receive_thread", packet_rx, netif->state, DEFAULT_THREAD_STACKSIZE, RX_PRIORITY);
717+
sys_thread_new("k64f_emac_thread", packet_rx, netif->state, DEFAULT_THREAD_STACKSIZE, RX_PRIORITY);
718718
#endif
719719

720720
/* Transmit cleanup task */
721721
err = sys_sem_new(&k64f_enetdata.TxCleanSem, 0);
722722
LWIP_ASSERT("TxCleanSem creation error", (err == ERR_OK));
723-
sys_thread_new("txclean_thread", packet_tx, netif->state, DEFAULT_THREAD_STACKSIZE, TX_PRIORITY);
723+
sys_thread_new("k64f_emac_txclean_thread", packet_tx, netif->state, DEFAULT_THREAD_STACKSIZE, TX_PRIORITY);
724724

725725
/* PHY monitoring task */
726-
sys_thread_new("phy_thread", k64f_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_PRIORITY);
726+
sys_thread_new("k64f_emac_phy_thread", k64f_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_PRIORITY);
727727

728728
/* Allow the PHY task to detect the initial link state and set up the proper flags */
729729
osDelay(10);

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472/nuc472_netif.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,17 +435,17 @@ err_t
435435
#if defined (__GNUC__)
436436
// mbed OS 2.0, DEFAULT_THREAD_STACKSIZE*3
437437
// mbed OS 5.0, DEFAULT_THREAD_STACKSIZE*5
438-
sys_thread_new("receive_thread", __packet_rx_task, &RxReadySem, DEFAULT_THREAD_STACKSIZE*5, osPriorityNormal);
438+
sys_thread_new("nuc472_emac_rx_thread", __packet_rx_task, &RxReadySem, DEFAULT_THREAD_STACKSIZE*5, osPriorityNormal);
439439
#else
440-
sys_thread_new("receive_thread", __packet_rx_task, &RxReadySem, DEFAULT_THREAD_STACKSIZE, osPriorityNormal);
440+
sys_thread_new("nuc472_emac_rx_thread", __packet_rx_task, &RxReadySem, DEFAULT_THREAD_STACKSIZE, osPriorityNormal);
441441
#endif
442442
/* PHY monitoring task */
443443
#if defined (__GNUC__)
444444
// mbed OS 2.0, DEFAULT_THREAD_STACKSIZE
445445
// mbed OS 5.0, DEFAULT_THREAD_STACKSIZE*2
446-
sys_thread_new("phy_thread", __phy_task, netif, DEFAULT_THREAD_STACKSIZE*2, osPriorityNormal);
446+
sys_thread_new("nuc472_emac_phy_thread", __phy_task, netif, DEFAULT_THREAD_STACKSIZE*2, osPriorityNormal);
447447
#else
448-
sys_thread_new("phy_thread", __phy_task, netif, DEFAULT_THREAD_STACKSIZE, osPriorityNormal);
448+
sys_thread_new("nuc472_emac_phy_thread", __phy_task, netif, DEFAULT_THREAD_STACKSIZE, osPriorityNormal);
449449
#endif
450450
/* Allow the PHY task to detect the initial link state and set up the proper flags */
451451
osDelay(10);

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NXP/lpc17_emac.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,16 +1031,16 @@ err_t eth_arch_enetif_init(struct netif *netif)
10311031
LWIP_ASSERT("TXLockMutex creation error", (err == ERR_OK));
10321032

10331033
/* Packet receive task */
1034-
lpc_enetdata.RxThread = sys_thread_new("receive_thread", packet_rx, netif->state, DEFAULT_THREAD_STACKSIZE, RX_PRIORITY);
1034+
lpc_enetdata.RxThread = sys_thread_new("lpc17_emac_rx_thread", packet_rx, netif->state, DEFAULT_THREAD_STACKSIZE, RX_PRIORITY);
10351035
LWIP_ASSERT("RxThread creation error", (lpc_enetdata.RxThread));
10361036

10371037
/* Transmit cleanup task */
10381038
err = sys_sem_new(&lpc_enetdata.TxCleanSem, 0);
10391039
LWIP_ASSERT("TxCleanSem creation error", (err == ERR_OK));
1040-
sys_thread_new("txclean_thread", packet_tx, netif->state, DEFAULT_THREAD_STACKSIZE, TX_PRIORITY);
1040+
sys_thread_new("lpc17_emac_txclean_thread", packet_tx, netif->state, DEFAULT_THREAD_STACKSIZE, TX_PRIORITY);
10411041

10421042
/* periodic PHY status update */
1043-
sys_thread_new("phy_thread", phy_update, netif, DEFAULT_THREAD_STACKSIZE, TX_PRIORITY);
1043+
sys_thread_new("lpc17_emac_phy_thread", phy_update, netif, DEFAULT_THREAD_STACKSIZE, TX_PRIORITY);
10441044
#endif
10451045

10461046
return ERR_OK;

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_RZ_A1H/rza1_emac.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ err_t eth_arch_enetif_init(struct netif *netif)
195195
sys_sem_new(&recv_ready_sem, 0);
196196

197197
/* task */
198-
sys_thread_new("rza1_recv_task", rza1_recv_task, netif, DEFAULT_THREAD_STACKSIZE, RECV_TASK_PRI);
199-
sys_thread_new("rza1_phy_task", rza1_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_TASK_PRI);
198+
sys_thread_new("rza1_emac_rx_thread", rza1_recv_task, netif, DEFAULT_THREAD_STACKSIZE, RECV_TASK_PRI);
199+
sys_thread_new("rza1_emac_phy_thread", rza1_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_TASK_PRI);
200200

201201
return ERR_OK;
202202
}

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM/stm32xx_emac.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,8 @@ err_t eth_arch_enetif_init(struct netif *netif)
451451
sys_mutex_new(&tx_lock_mutex);
452452

453453
/* task */
454-
sys_thread_new("_eth_arch_rx_task", _eth_arch_rx_task, netif, DEFAULT_THREAD_STACKSIZE, RECV_TASK_PRI);
455-
sys_thread_new("_eth_arch_phy_task", _eth_arch_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_TASK_PRI);
454+
sys_thread_new("stm32_emac_rx_thread", _eth_arch_rx_task, netif, DEFAULT_THREAD_STACKSIZE, RECV_TASK_PRI);
455+
sys_thread_new("stm32_emac_phy_thread", _eth_arch_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_TASK_PRI);
456456

457457
/* initialize the hardware */
458458
_eth_arch_low_level_init(netif);

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_VK_RZ_A1H/rza1_emac.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ err_t eth_arch_enetif_init(struct netif *netif)
195195
sys_sem_new(&recv_ready_sem, 0);
196196

197197
/* task */
198-
sys_thread_new("rza1_recv_task", rza1_recv_task, netif, DEFAULT_THREAD_STACKSIZE, RECV_TASK_PRI);
199-
sys_thread_new("rza1_phy_task", rza1_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_TASK_PRI);
198+
sys_thread_new("rza1_emac_rx_thread", rza1_recv_task, netif, DEFAULT_THREAD_STACKSIZE, RECV_TASK_PRI);
199+
sys_thread_new("rza1_emac_phy_thread", rza1_phy_task, netif, DEFAULT_THREAD_STACKSIZE, PHY_TASK_PRI);
200200

201201
return ERR_OK;
202202
}

features/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ void sys_sem_free(sys_sem_t *sem) {}
378378
* @return a new mutex */
379379
err_t sys_mutex_new(sys_mutex_t *mutex) {
380380
memset(&mutex->data, 0, sizeof(mutex->data));
381+
mutex->attr.name = "lwip_mutex";
381382
mutex->attr.cb_mem = &mutex->data;
382383
mutex->attr.cb_size = sizeof(mutex->data);
383384
mutex->id = osMutexNew(&mutex->attr);
@@ -417,6 +418,7 @@ mbed_rtos_storage_mutex_t lwip_sys_mutex_data;
417418

418419
void sys_init(void) {
419420
us_ticker_read(); // Init sys tick
421+
lwip_sys_mutex_attr.name = "lwip_sys_mutex";
420422
lwip_sys_mutex_attr.cb_mem = &lwip_sys_mutex_data;
421423
lwip_sys_mutex_attr.cb_size = sizeof(lwip_sys_mutex_data);
422424
lwip_sys_mutex = osMutexNew(&lwip_sys_mutex_attr);
@@ -517,7 +519,7 @@ sys_thread_t sys_thread_new(const char *pcName,
517519
sys_thread_t t = (sys_thread_t)&thread_pool[thread_pool_index];
518520
thread_pool_index++;
519521

520-
t->attr.name = pcName;
522+
t->attr.name = pcName ? pcName : "lwip_unnamed_thread";
521523
t->attr.priority = (osPriority_t)priority;
522524
t->attr.cb_size = sizeof(t->data);
523525
t->attr.cb_mem = &t->data;

0 commit comments

Comments
 (0)