gnrc_pktdump: make pid global

pr/gpio
Cenk Gündoğan 7 years ago
parent f6ee89992a
commit f5df674a4f

@ -50,12 +50,9 @@ extern "C" {
#endif
/**
* @brief Get the PID of the pktdump thread
*
* @return PID of the pktdump thread
* @return @ref KERNEL_PID_UNDEF if not initialized
* @brief The PID of the pktdump thread
*/
kernel_pid_t gnrc_pktdump_getpid(void);
extern kernel_pid_t gnrc_pktdump_pid;
/**
* @brief Start the packet dump thread and listening for incoming packets

@ -36,7 +36,7 @@
/**
* @brief PID of the pktdump thread
*/
static kernel_pid_t _pid = KERNEL_PID_UNDEF;
kernel_pid_t gnrc_pktdump_pid = KERNEL_PID_UNDEF;
/**
* @brief Stack for the pktdump thread
@ -154,17 +154,12 @@ static void *_eventloop(void *arg)
return NULL;
}
kernel_pid_t gnrc_pktdump_getpid(void)
{
return _pid;
}
kernel_pid_t gnrc_pktdump_init(void)
{
if (_pid == KERNEL_PID_UNDEF) {
_pid = thread_create(_stack, sizeof(_stack), GNRC_PKTDUMP_PRIO,
if (gnrc_pktdump_pid == KERNEL_PID_UNDEF) {
gnrc_pktdump_pid = thread_create(_stack, sizeof(_stack), GNRC_PKTDUMP_PRIO,
THREAD_CREATE_STACKTEST,
_eventloop, NULL, "pktdump");
}
return _pid;
return gnrc_pktdump_pid;
}

Loading…
Cancel
Save