gnrc netreg: make message queue mandatory
Any thread that registers for gnrc events (i.e. incoming packets) must provide a message queue.
This commit is contained in:
parent
4e05254eb7
commit
2e342c7e9b
@ -79,6 +79,8 @@ void gnrc_netreg_init(void);
|
|||||||
* @warning Call gnrc_netreg_unregister() *before* you leave the context you
|
* @warning Call gnrc_netreg_unregister() *before* you leave the context you
|
||||||
* allocated @p entry in. Otherwise it might get overwritten.
|
* allocated @p entry in. Otherwise it might get overwritten.
|
||||||
*
|
*
|
||||||
|
* @pre The calling thread must provide a message queue.
|
||||||
|
*
|
||||||
* @return 0 on success
|
* @return 0 on success
|
||||||
* @return -EINVAL if @p type was < GNRC_NETTYPE_UNDEF or >= GNRC_NETTYPE_NUMOF
|
* @return -EINVAL if @p type was < GNRC_NETTYPE_UNDEF or >= GNRC_NETTYPE_NUMOF
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -37,6 +37,9 @@ void gnrc_netreg_init(void)
|
|||||||
|
|
||||||
int gnrc_netreg_register(gnrc_nettype_t type, gnrc_netreg_entry_t *entry)
|
int gnrc_netreg_register(gnrc_nettype_t type, gnrc_netreg_entry_t *entry)
|
||||||
{
|
{
|
||||||
|
/* only threads with a message queue are allowed to register at gnrc */
|
||||||
|
assert(sched_active_thread->msg_array);
|
||||||
|
|
||||||
if (_INVALID_TYPE(type)) {
|
if (_INVALID_TYPE(type)) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user