mirror of
https://github.com/obgm/libcoap.git
synced 2026-10-29 22:15:49 +03:00
If an app request call-back modifies any data associated with a resource, then multiple threads can attempt to unsafely modify the data at the same time. Lock the resource when calling the app request handler (as global_lock is unlocked) to prevent concurrent changes to the resource information. If the app request handler is definately known to not modify the resource information, then COAP_RESOURCE_SAFE_REQUEST_HANDLER can be set in the flags for coap_resource_init(). Usually if there is a PUT, POST, PATCH or IPATCH handler it is unsafe to set this. Setting this will reduce lock contention.