OpenImageIO
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Macros | Typedefs | Functions | Variables
thread.h File Reference

Wrappers and utilities for multithreading. More...

#include "version.h"
#include "sysutil.h"
#include <boost/version.hpp>
#include <boost/thread.hpp>
#include <boost/thread/tss.hpp>

Go to the source code of this file.

Classes

class  null_lock< T >
 
class  null_thread_specific_ptr< T >
 
class  atomic_backoff
 
class  atomic< T >
 
class  spin_mutex
 
class  spin_mutex::lock_guard
 
class  spin_rw_mutex
 
class  spin_rw_mutex::read_lock_guard
 
class  spin_rw_mutex::write_lock_guard
 

Macros

#define USE_TBB   0
 
#define USE_TBB_ATOMIC   0
 
#define USE_TBB_SPINLOCK   0
 

Typedefs

typedef boost::mutex mutex
 
typedef boost::recursive_mutex recursive_mutex
 
typedef boost::lock_guard
< boost::mutex > 
lock_guard
 
typedef boost::lock_guard
< boost::recursive_mutex > 
recursive_lock_guard
 
typedef atomic< int > atomic_int
 
typedef atomic< long long > atomic_ll
 
typedef spin_mutex::lock_guard spin_lock
 
typedef
spin_rw_mutex::read_lock_guard 
spin_rw_read_lock
 
typedef
spin_rw_mutex::write_lock_guard 
spin_rw_write_lock
 

Functions

int atomic_exchange_and_add (volatile int *at, int x)
 
long long atomic_exchange_and_add (volatile long long *at, long long x)
 
bool atomic_compare_and_exchange (volatile int *at, int compareval, int newval)
 
bool atomic_compare_and_exchange (volatile long long *at, long long compareval, long long newval)
 
void yield ()
 
void pause (int delay)
 

Variables

 OIIO_NAMESPACE_ENTER
 

Detailed Description

Wrappers and utilities for multithreading.

Function Documentation

bool atomic_compare_and_exchange ( volatile int *  at,
int  compareval,
int  newval 
)
inline

Atomic version of: if (*at == compareval) { *at = newval; return true; } else { return false;

int atomic_exchange_and_add ( volatile int *  at,
int  x 
)
inline

Atomic version of: r = *at, *at += x, return r For each of several architectures.

void yield ( )
inline

Yield the processor for the rest of the timeslice.

Variable Documentation

OIIO_NAMESPACE_ENTER
Initial value:
{
class null_mutex {
public:
null_mutex () { }
~null_mutex () { }
void lock () { }
void unlock () { }
void lock_shared () { }
void unlock_shared () { }
}