tor
master
|
Cross-platform threading and inter-thread communication logic. (Platform-specific parts are written in the other compat_*threads modules.) More...
#include "orconfig.h"
#include <stdlib.h>
#include "compat.h"
#include "compat_threads.h"
#include "util.h"
#include "torlog.h"
Functions | |
tor_mutex_t * | tor_mutex_new (void) |
tor_mutex_t * | tor_mutex_new_nonrecursive (void) |
void | tor_mutex_free_ (tor_mutex_t *m) |
tor_cond_t * | tor_cond_new (void) |
void | tor_cond_free_ (tor_cond_t *c) |
void | set_main_thread (void) |
int | in_main_thread (void) |
int | alert_sockets_create (alert_sockets_t *socks_out, uint32_t flags) |
void | alert_sockets_close (alert_sockets_t *socks) |
void | atomic_counter_init (atomic_counter_t *counter) |
void | atomic_counter_destroy (atomic_counter_t *counter) |
void | atomic_counter_add (atomic_counter_t *counter, size_t add) |
void | atomic_counter_sub (atomic_counter_t *counter, size_t sub) |
size_t | atomic_counter_get (atomic_counter_t *counter) |
size_t | atomic_counter_exchange (atomic_counter_t *counter, size_t newval) |
Cross-platform threading and inter-thread communication logic. (Platform-specific parts are written in the other compat_*threads modules.)
void alert_sockets_close | ( | alert_sockets_t * | socks | ) |
Close the sockets in socks.
int alert_sockets_create | ( | alert_sockets_t * | socks_out, |
uint32_t | flags | ||
) |
Allocate a new set of alert sockets, and set the appropriate function pointers, in socks_out.
void atomic_counter_add | ( | atomic_counter_t * | counter, |
size_t | add | ||
) |
Add a value to an atomic counter.
void atomic_counter_destroy | ( | atomic_counter_t * | counter | ) |
Clean up all resources held by an atomic counter.
size_t atomic_counter_exchange | ( | atomic_counter_t * | counter, |
size_t | newval | ||
) |
Replace the value of an atomic counter; return the old one.
size_t atomic_counter_get | ( | atomic_counter_t * | counter | ) |
Return the current value of an atomic counter
void atomic_counter_init | ( | atomic_counter_t * | counter | ) |
Initialize a new atomic counter with the value 0
void atomic_counter_sub | ( | atomic_counter_t * | counter, |
size_t | sub | ||
) |
Subtract a value from an atomic counter.
int in_main_thread | ( | void | ) |
Return true iff called from the main thread.
void set_main_thread | ( | void | ) |
Start considering the current thread to be the 'main thread'. This has no effect on anything besides in_main_thread().
void tor_cond_free_ | ( | tor_cond_t * | c | ) |
Free all storage held in c.
tor_cond_t* tor_cond_new | ( | void | ) |
Allocate and return a new condition variable.
void tor_mutex_free_ | ( | tor_mutex_t * | m | ) |
Release all storage and system resources held by m.
tor_mutex_t* tor_mutex_new | ( | void | ) |
Return a newly allocated, ready-for-use mutex.
tor_mutex_t* tor_mutex_new_nonrecursive | ( | void | ) |
Return a newly allocated, ready-for-use mutex. This one might be non-recursive, if that's faster.