tor  master
Functions
compat_threads.c File Reference

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"
Include dependency graph for compat_threads.c:

Functions

tor_mutex_ttor_mutex_new (void)
 
tor_mutex_ttor_mutex_new_nonrecursive (void)
 
void tor_mutex_free_ (tor_mutex_t *m)
 
tor_cond_ttor_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)
 

Detailed Description

Cross-platform threading and inter-thread communication logic. (Platform-specific parts are written in the other compat_*threads modules.)

Function Documentation

◆ alert_sockets_close()

void alert_sockets_close ( alert_sockets_t socks)

Close the sockets in socks.

◆ alert_sockets_create()

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.

Here is the call graph for this function:

◆ atomic_counter_add()

void atomic_counter_add ( atomic_counter_t counter,
size_t  add 
)

Add a value to an atomic counter.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ atomic_counter_destroy()

void atomic_counter_destroy ( atomic_counter_t counter)

Clean up all resources held by an atomic counter.

Here is the call graph for this function:

◆ atomic_counter_exchange()

size_t atomic_counter_exchange ( atomic_counter_t counter,
size_t  newval 
)

Replace the value of an atomic counter; return the old one.

Here is the call graph for this function:

◆ atomic_counter_get()

size_t atomic_counter_get ( atomic_counter_t counter)

Return the current value of an atomic counter

Here is the call graph for this function:
Here is the caller graph for this function:

◆ atomic_counter_init()

void atomic_counter_init ( atomic_counter_t counter)

Initialize a new atomic counter with the value 0

Here is the call graph for this function:
Here is the caller graph for this function:

◆ atomic_counter_sub()

void atomic_counter_sub ( atomic_counter_t counter,
size_t  sub 
)

Subtract a value from an atomic counter.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ in_main_thread()

int in_main_thread ( void  )

Return true iff called from the main thread.

Here is the caller graph for this function:

◆ set_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().

◆ tor_cond_free_()

void tor_cond_free_ ( tor_cond_t c)

Free all storage held in c.

Here is the call graph for this function:

◆ tor_cond_new()

tor_cond_t* tor_cond_new ( void  )

Allocate and return a new condition variable.

◆ tor_mutex_free_()

void tor_mutex_free_ ( tor_mutex_t m)

Release all storage and system resources held by m.

Here is the call graph for this function:

◆ tor_mutex_new()

tor_mutex_t* tor_mutex_new ( void  )

Return a newly allocated, ready-for-use mutex.

Here is the caller graph for this function:

◆ tor_mutex_new_nonrecursive()

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.