1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-26 06:53:52 +01:00

gnrc_pktdump: make pid global

This commit is contained in:
Cenk Gündoğan 2016-03-11 14:22:20 +01:00
parent f6ee89992a
commit f5df674a4f
2 changed files with 6 additions and 14 deletions

View File

@ -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

View File

@ -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;
}