Shadowrun: Awakened 29 September 2011 - Build 871
Classes | Namespaces | Defines | Functions
tbb_machine.h File Reference
#include "tbb_stddef.h"
Include dependency graph for Include/tbb/tbb_machine.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  tbb::internal::atomic_backoff
 Class that implements exponential backoff.
struct  tbb::internal::reverse< class >
struct  tbb::internal::type_with_alignment< N >
struct  tbb::internal::type_with_alignment< 1 >
struct  tbb::internal::type_with_alignment< 2 >
struct  tbb::internal::type_with_alignment< 4 >
struct  tbb::internal::type_with_alignment< 8 >

Namespaces

namespace  tbb
 

The namespace tbb contains all components of the library.


namespace  tbb::internal

Defines

#define __TBB_CompareAndSwap1   tbb::internal::__TBB_CompareAndSwapGeneric<1,uint8_t>
#define __TBB_CompareAndSwap2   tbb::internal::__TBB_CompareAndSwapGeneric<2,uint16_t>
#define __TBB_CompareAndSwapW   tbb::internal::__TBB_CompareAndSwapGeneric<sizeof(ptrdiff_t),ptrdiff_t>
#define __TBB_FetchAndAdd1   tbb::internal::__TBB_FetchAndAddGeneric<1,uint8_t>
#define __TBB_FetchAndAdd2   tbb::internal::__TBB_FetchAndAddGeneric<2,uint16_t>
#define __TBB_FetchAndAdd4   tbb::internal::__TBB_FetchAndAddGeneric<4,uint32_t>
#define __TBB_FetchAndAdd8   tbb::internal::__TBB_FetchAndAddGeneric<8,uint64_t>
#define __TBB_FetchAndAddW   tbb::internal::__TBB_FetchAndAddGeneric<sizeof(ptrdiff_t),ptrdiff_t>
#define __TBB_FetchAndAddWrelease   __TBB_FetchAndAddW
#define __TBB_FetchAndDecrementWrelease(P)   __TBB_FetchAndAddW(P,(-1))
#define __TBB_FetchAndIncrementWacquire(P)   __TBB_FetchAndAddW(P,1)
#define __TBB_FetchAndStore1   tbb::internal::__TBB_FetchAndStoreGeneric<1,uint8_t>
#define __TBB_FetchAndStore2   tbb::internal::__TBB_FetchAndStoreGeneric<2,uint16_t>
#define __TBB_FetchAndStore4   tbb::internal::__TBB_FetchAndStoreGeneric<4,uint32_t>
#define __TBB_FetchAndStore8   tbb::internal::__TBB_FetchAndStoreGeneric<8,uint64_t>
#define __TBB_FetchAndStoreW   tbb::internal::__TBB_FetchAndStoreGeneric<sizeof(ptrdiff_t),ptrdiff_t>
#define __TBB_TypeWithAlignmentAtLeastAsStrict(T)   __TBB_machine_type_with_strictest_alignment

Functions

void __TBB_AtomicAND (volatile void *operand, uintptr_t addend)
void __TBB_AtomicOR (volatile void *operand, uintptr_t addend)
T tbb::internal::__TBB_CompareAndSwapGeneric (volatile void *ptr, T value, T comparand)
uint8_t tbb::internal::__TBB_CompareAndSwapGeneric< 1, uint8_t > (volatile void *ptr, uint8_t value, uint8_t comparand)
uint16_t tbb::internal::__TBB_CompareAndSwapGeneric< 2, uint16_t > (volatile void *ptr, uint16_t value, uint16_t comparand)
uint32_t tbb::internal::__TBB_CompareAndSwapGeneric< 4, uint32_t > (volatile void *ptr, uint32_t value, uint32_t comparand)
uint64_t tbb::internal::__TBB_CompareAndSwapGeneric< 8, uint64_t > (volatile void *ptr, uint64_t value, uint64_t comparand)
T tbb::internal::__TBB_FetchAndAddGeneric (volatile void *ptr, T addend)
T tbb::internal::__TBB_FetchAndStoreGeneric (volatile void *ptr, T value)
template<typename T >
T __TBB_load_with_acquire (const volatile T &location)
 Load with acquire semantics; i.e., no following memory operation can move above the load.
uintptr_t __TBB_LockByte (unsigned char &flag)
intptr_t __TBB_Log2 (uintptr_t x)
T tbb::internal::__TBB_MaskedCompareAndSwap (volatile T *ptr, T value, T comparand)
void __TBB_Pause (int32_t)
template<typename T >
T __TBB_ReverseBits (T src)
unsigned char __TBB_ReverseByte (unsigned char src)
template<typename T , typename V >
void __TBB_store_with_release (volatile T &location, V value)
 Store with release semantics; i.e., no prior memory operation can move below the store.
bool __TBB_TryLockByte (unsigned char &flag)
void tbb::internal::spin_wait_until_eq (const volatile T &location, const U value)
 Spin UNTIL the value of the variable is equal to a given value.
void tbb::internal::spin_wait_while_eq (const volatile T &location, U value)
 Spin WHILE the value of the variable is equal to a given value.

Define Documentation

#define __TBB_CompareAndSwap1   tbb::internal::__TBB_CompareAndSwapGeneric<1,uint8_t>

Definition at line 355 of file Include/tbb/tbb_machine.h.

Referenced by __TBB_TryLockByte().

#define __TBB_CompareAndSwap2   tbb::internal::__TBB_CompareAndSwapGeneric<2,uint16_t>

Definition at line 359 of file Include/tbb/tbb_machine.h.

#define __TBB_CompareAndSwapW   tbb::internal::__TBB_CompareAndSwapGeneric<sizeof(ptrdiff_t),ptrdiff_t>

Definition at line 363 of file Include/tbb/tbb_machine.h.

Referenced by __TBB_AtomicAND(), and __TBB_AtomicOR().

#define __TBB_FetchAndAdd1   tbb::internal::__TBB_FetchAndAddGeneric<1,uint8_t>

Definition at line 367 of file Include/tbb/tbb_machine.h.

#define __TBB_FetchAndAdd2   tbb::internal::__TBB_FetchAndAddGeneric<2,uint16_t>

Definition at line 371 of file Include/tbb/tbb_machine.h.

#define __TBB_FetchAndAdd4   tbb::internal::__TBB_FetchAndAddGeneric<4,uint32_t>

Definition at line 375 of file Include/tbb/tbb_machine.h.

#define __TBB_FetchAndAdd8   tbb::internal::__TBB_FetchAndAddGeneric<8,uint64_t>

Definition at line 379 of file Include/tbb/tbb_machine.h.

#define __TBB_FetchAndAddW   tbb::internal::__TBB_FetchAndAddGeneric<sizeof(ptrdiff_t),ptrdiff_t>

Definition at line 383 of file Include/tbb/tbb_machine.h.

#define __TBB_FetchAndAddWrelease   __TBB_FetchAndAddW

Definition at line 532 of file Include/tbb/tbb_machine.h.

#define __TBB_FetchAndDecrementWrelease (   P)    __TBB_FetchAndAddW(P,(-1))

Definition at line 540 of file Include/tbb/tbb_machine.h.

#define __TBB_FetchAndIncrementWacquire (   P)    __TBB_FetchAndAddW(P,1)

Definition at line 536 of file Include/tbb/tbb_machine.h.

#define __TBB_FetchAndStore1   tbb::internal::__TBB_FetchAndStoreGeneric<1,uint8_t>

Definition at line 387 of file Include/tbb/tbb_machine.h.

#define __TBB_FetchAndStore2   tbb::internal::__TBB_FetchAndStoreGeneric<2,uint16_t>

Definition at line 391 of file Include/tbb/tbb_machine.h.

#define __TBB_FetchAndStore4   tbb::internal::__TBB_FetchAndStoreGeneric<4,uint32_t>

Definition at line 395 of file Include/tbb/tbb_machine.h.

#define __TBB_FetchAndStore8   tbb::internal::__TBB_FetchAndStoreGeneric<8,uint64_t>

Definition at line 399 of file Include/tbb/tbb_machine.h.

#define __TBB_FetchAndStoreW   tbb::internal::__TBB_FetchAndStoreGeneric<sizeof(ptrdiff_t),ptrdiff_t>

Definition at line 403 of file Include/tbb/tbb_machine.h.

#define __TBB_TypeWithAlignmentAtLeastAsStrict (   T)    __TBB_machine_type_with_strictest_alignment

Definition at line 320 of file Include/tbb/tbb_machine.h.


Function Documentation

void __TBB_AtomicAND ( volatile void *  operand,
uintptr_t  addend 
) [inline]

Definition at line 594 of file Include/tbb/tbb_machine.h.

References __TBB_CompareAndSwapW, and tbb::internal::atomic_backoff::pause().

                                                                        {
    tbb::internal::atomic_backoff b;
    for(;;) {
        uintptr_t tmp = *(volatile uintptr_t *)operand;
        uintptr_t result = __TBB_CompareAndSwapW(operand, tmp&addend, tmp);
        if( result==tmp ) break;
        b.pause();
    }
}
void __TBB_AtomicOR ( volatile void *  operand,
uintptr_t  addend 
) [inline]

Definition at line 582 of file Include/tbb/tbb_machine.h.

References __TBB_CompareAndSwapW, and tbb::internal::atomic_backoff::pause().

                                                                       {
    tbb::internal::atomic_backoff b;
    for(;;) {
        uintptr_t tmp = *(volatile uintptr_t *)operand;
        uintptr_t result = __TBB_CompareAndSwapW(operand, tmp|addend, tmp);
        if( result==tmp ) break;
        b.pause();
    }
}
template<typename T >
T __TBB_load_with_acquire ( const volatile T location) [inline]

Definition at line 106 of file Include/tbb/tbb_machine.h.

References __TBB_release_consistency_helper, and T.

                                                                 {
        T temp = location;
        __TBB_release_consistency_helper();
        return temp;
    }
uintptr_t __TBB_LockByte ( unsigned char &  flag) [inline]

Definition at line 612 of file Include/tbb/tbb_machine.h.

References __TBB_TryLockByte, and tbb::internal::atomic_backoff::pause().

                                                       {
    if ( !__TBB_TryLockByte(flag) ) {
        tbb::internal::atomic_backoff b;
        do {
            b.pause();
        } while ( !__TBB_TryLockByte(flag) );
    }
    return 0;
}
intptr_t __TBB_Log2 ( uintptr_t  x) [inline]

Definition at line 566 of file Include/tbb/tbb_machine.h.

                                          {
    if( x==0 ) return -1;
    intptr_t result = 0;
    uintptr_t tmp;
#if __TBB_WORDSIZE>=8
    if( (tmp = x>>32) ) { x=tmp; result += 32; }
#endif
    if( (tmp = x>>16) ) { x=tmp; result += 16; }
    if( (tmp = x>>8) )  { x=tmp; result += 8; }
    if( (tmp = x>>4) )  { x=tmp; result += 4; }
    if( (tmp = x>>2) )  { x=tmp; result += 2; }
    return (x&2)? result+1: result;
}
void __TBB_Pause ( int32_t  ) [inline]

Definition at line 123 of file Include/tbb/tbb_machine.h.

References __TBB_Yield.

                                     {
        __TBB_Yield();
    }
template<typename T >
T __TBB_ReverseBits ( T  src)

Definition at line 630 of file Include/tbb/tbb_machine.h.

References __TBB_ReverseByte(), and T.

{
    T dst;
    unsigned char *original = (unsigned char *) &src;
    unsigned char *reversed = (unsigned char *) &dst;

    for( int i = sizeof(T)-1; i >= 0; i-- )
        reversed[i] = __TBB_ReverseByte( original[sizeof(T)-i-1] );

    return dst;
}
unsigned char __TBB_ReverseByte ( unsigned char  src) [inline]

Definition at line 624 of file Include/tbb/tbb_machine.h.

Referenced by __TBB_ReverseBits().

template<typename T , typename V >
void __TBB_store_with_release ( volatile T location,
V  value 
) [inline]

Definition at line 116 of file Include/tbb/tbb_machine.h.

References __TBB_release_consistency_helper, and T.

bool __TBB_TryLockByte ( unsigned char &  flag) [inline]

Definition at line 606 of file Include/tbb/tbb_machine.h.

References __TBB_CompareAndSwap1.

                                                     {
    return __TBB_CompareAndSwap1(&flag,1,0)==0;
}

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net