Skip to content

Commit

Permalink
gcoap: add gcoap_get_event_queue() to use event API
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian18 committed Jun 11, 2024
1 parent 87529ac commit c758fb2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sys/include/net/gcoap.h
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,16 @@ typedef struct {
*/
kernel_pid_t gcoap_init(void);

/**
* @brief Get a pointer to the internal gcoap event queue, to offload tasks to the gcoap thread
* using RIOT's event API
*
* @warning Beware to only use the event API on it.
*
* @return Event queue pointer
*/
event_queue_t *gcoap_get_event_queue(void);

/**
* @brief Starts listening for resource paths
*
Expand Down
6 changes: 6 additions & 0 deletions sys/net/application_layer/gcoap/gcoap.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <string.h>

#include "assert.h"
#include "event.h"
#include "net/coap.h"
#include "net/gcoap.h"
#include "net/gcoap/forward_proxy.h"
Expand Down Expand Up @@ -1981,6 +1982,11 @@ void gcoap_forward_proxy_post_event(void *arg)
event_post(&_queue, arg);
}

event_queue_t *gcoap_get_event_queue(void)
{
return &_queue;
}

/* separate response API */

int gcoap_resp_prepare_separate(gcoap_separate_response_ctx_t *ctx,
Expand Down

0 comments on commit c758fb2

Please sign in to comment.