Commit Graph
2 Commits
Author SHA1 Message Date
Olaf Bergmann abec5b8228 coap_mutex.h: Use pthread mutexes if detected by configure
On systems that support pthread mutexes, stack usage can be minimized
with the use of static variables. Concurrent access is protected
on these systems with mutexes. Platforms that do not have pthread
support must map the coap_mutex_* macros accordingly.
2019-09-10 13:28:44 +02:00
Jon Shallow cb18375df7 For limited stacks, remove large items off the stack and make them static
When there is a limited stack size, having large data items on the stack
can easily cause stack overflows.

This makes integration with any constrained stack O/S a lot easier.

include/coap2/coap_mutex.h:

Create coap_ mutex functions which are platform independent to protect
the (now) static variables if compiled with "-DCOAP_CONSTRAINED_STACK=1"

Makefile.am:

Include include/coap2/coap_mutex.h for distribution

coap_config.h.contiki:
coap_config.h.lwip:

As CONTIKI and LWIP have constrained stacks, set
"#define COAP_CONSTRAINED_STACK 1"

src/coap_debug.c:
src/coap_io.c:
src/net.c:

coap_show_pdu()
coap_log_impl()
coap_run_once()
coap_read_session()
coap_read_endpoint()
Move large data items out of the functions' stack and make them static
variables (defined within the function) if COAP_CONSTRAINED_STACK is defined.
Protect the usage of these static variables by mutexes.

Note: if "-DCOAP_CONSTRAINED_STACK=0" is used, then the stack will not
be constrained.
2019-04-11 15:53:21 +01:00