GNU libmicrohttpd  0.9.29
mhd_locks.h File Reference

Header for platform-independent locks abstraction. More...

#include "mhd_options.h"
#include <stdio.h>
#include <stdlib.h>
Include dependency graph for mhd_locks.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MHD_PANIC(msg)
 
#define MHD_mutex_destroy_chk_(pmutex)
 
#define MHD_mutex_lock_chk_(pmutex)
 
#define MHD_mutex_unlock_chk_(pmutex)
 

Detailed Description

Header for platform-independent locks abstraction.

Author
Karlson2k (Evgeny Grin)
Christian Grothoff

Provides basic abstraction for locks/mutex. Any functions can be implemented as macro on some platforms unless explicitly marked otherwise. Any function argument can be skipped in macro, so avoid variable modification in function parameters.

Warning
Unlike pthread functions, most of functions return nonzero on success.

Definition in file mhd_locks.h.

Macro Definition Documentation

◆ MHD_mutex_destroy_chk_

#define MHD_mutex_destroy_chk_ (   pmutex)
Value:
do { \
if (!MHD_mutex_destroy_(pmutex)) \
MHD_PANIC(_("Failed to destroy mutex.\n")); \
} while(0)
#define _(String)
Definition: mhd_options.h:42

Destroy previously initialised mutex and abort execution if error is detected.

Parameters
pmutexpointer to mutex

Definition at line 109 of file mhd_locks.h.

Referenced by MHD_create_response_from_data(), MHD_destroy_response(), MHD_start_daemon_va(), and MHD_stop_daemon().

◆ MHD_mutex_lock_chk_

#define MHD_mutex_lock_chk_ (   pmutex)
Value:
do { \
if (!MHD_mutex_lock_(pmutex)) \
MHD_PANIC(_("Failed to lock mutex.\n")); \
} while(0)
#define _(String)
Definition: mhd_options.h:42

Acquire lock on previously initialised mutex. If mutex was already locked by other thread, function blocks until mutex becomes available. If error is detected, execution will be aborted.

Parameters
pmutexpointer to mutex

Definition at line 142 of file mhd_locks.h.

Referenced by check_nonce_nc(), cleanup_connection(), close_all_connections(), close_connection(), internal_add_connection(), internal_suspend_connection_(), MHD_cleanup_connections(), MHD_connection_handle_idle(), MHD_connection_handle_write(), MHD_destroy_response(), MHD_increment_response_rc(), MHD_ip_count_lock(), MHD_resume_connection(), MHD_set_connection_option(), MHD_update_last_activity_(), and resume_suspended_connections().

◆ MHD_mutex_unlock_chk_

#define MHD_mutex_unlock_chk_ (   pmutex)
Value:
do { \
if (!MHD_mutex_unlock_(pmutex)) \
MHD_PANIC(_("Failed to unlock mutex.\n")); \
} while(0)
#define _(String)
Definition: mhd_options.h:42

Unlock previously initialised and locked mutex. If error is detected, execution will be aborted.

Parameters
pmutexpointer to mutex

Definition at line 168 of file mhd_locks.h.

Referenced by check_nonce_nc(), cleanup_connection(), close_all_connections(), close_connection(), internal_add_connection(), internal_suspend_connection_(), MHD_cleanup_connections(), MHD_connection_handle_idle(), MHD_connection_handle_write(), MHD_destroy_response(), MHD_increment_response_rc(), MHD_ip_count_unlock(), MHD_resume_connection(), MHD_set_connection_option(), MHD_update_last_activity_(), resume_suspended_connections(), and try_ready_normal_body().

◆ MHD_PANIC

#define MHD_PANIC (   msg)
Value:
do { fprintf (stderr, \
"Abnormal termination at %d line in file %s: %s\n", \
(int)__LINE__, __FILE__, msg); abort();} while(0)

Definition at line 61 of file mhd_locks.h.