19#if COAP_THREAD_RECURSIVE_CHECK 
   21coap_lock_unlock_func(
const char *file, 
int line) {
 
   23  if (global_lock.in_callback) {
 
   24    assert(global_lock.lock_count > 0);
 
   25    global_lock.lock_count--;
 
   28    global_lock.unlock_file = file;
 
   29    global_lock.unlock_line = line;
 
   35coap_lock_lock_func(
const char *file, 
int line) {
 
   43      if (global_lock.in_callback) {
 
   45        global_lock.lock_count++;
 
   46        assert(global_lock.in_callback == global_lock.lock_count);
 
   50                       global_lock.lock_file, global_lock.lock_line, file, line);
 
   58  assert(!global_lock.in_callback);
 
   60  global_lock.lock_file = file;
 
   61  global_lock.lock_line = line;
 
   68coap_lock_unlock_func(
void) {
 
   70  if (global_lock.in_callback) {
 
   71    assert(global_lock.lock_count > 0);
 
   72    global_lock.lock_count--;
 
   80coap_lock_lock_func(
void) {
 
   90    global_lock.lock_count++;
 
   91    assert(global_lock.in_callback == global_lock.lock_count);
 
   96  assert(!global_lock.in_callback);
 
  104static pthread_t *thread_id = NULL;
 
  105static uint32_t thread_id_count = 0;
 
  110uint32_t max_thread_no = 0;
 
  115} coap_thread_param_t;
 
  118coap_io_process_worker_thread(
void *arg) {
 
  119  coap_thread_param_t *thread_param = (coap_thread_param_t *)arg;
 
  122  thread_no = thread_param->thread_no;
 
  147  max_thread_no = 1 + thread_count;
 
  151    coap_log_err(
"thread start up memory allocate failure\n");
 
  155  for (i = 0; i < thread_count ; i++) {
 
  159    thread_param->context = context;
 
  160    thread_param->thread_no = i + 2;
 
  161    s = pthread_create(&thread_id[i], NULL,
 
  162                       &coap_io_process_worker_thread, thread_param);
 
  186  for (i = 0; i < thread_id_count ; i++) {
 
  187    int s = pthread_kill(thread_id[i], SIGINT);
 
  192  for (i = 0; i < thread_id_count ; i++) {
 
  194    int s = pthread_join(thread_id[i], &retval);
 
const char * coap_socket_strerror(void)
 
volatile int coap_thread_quit
 
Library specific build wrapper for coap_internal.h.
 
void * coap_malloc_type(coap_memory_tag_t type, size_t size)
Allocates a chunk of size bytes and returns a pointer to the newly allocated memory.
 
void coap_free_type(coap_memory_tag_t type, void *p)
Releases the memory that was allocated by coap_malloc_type().
 
#define coap_mutex_unlock(a)
 
#define coap_mutex_trylock(a)
 
#define coap_mutex_lock(a)
 
int coap_io_process_lkd(coap_context_t *ctx, uint32_t timeout_ms)
The main I/O processing function.
 
int coap_io_process_configure_threads(coap_context_t *context, uint32_t thread_count)
Configure a defined number of threads to do the alternate coap_io_process() work with traffic load ba...
 
void coap_io_process_remove_threads(coap_context_t *context)
Release the coap_io_process() worker threads.
 
#define coap_lock_unlock()
Dummy for no thread-safe code.
 
#define coap_lock_lock(failed)
Dummy for no thread-safe code.
 
#define coap_log_debug(...)
 
#define coap_log_alert(...)
 
#define coap_log_err(...)
 
#define COAP_THREAD_LOCAL_VAR
 
The CoAP stack's global state is stored in a coap_context_t object.