Orocos Real-Time Toolkit
2.9.0
|
Please use this template to create new oro_arch.h files for different target architectures or compilers. More...
Go to the source code of this file.
Typedefs | |
typedef struct oro_atomic_t_interface | oro_atomic_t |
Functions | |
void | ORO_ATOMIC_SETUP (oro_atomic_t *a, int n) |
Initializes the uninitialized atomic structure a with a counter value of 'n'. More... | |
void | ORO_ATOMIC_CLEANUP (oro_atomic_t *a) |
Cleans up all resources allocated durint the setup of atomic structure a. More... | |
int | oro_atomic_read (oro_atomic_t *a) |
Returns the current counter value of the atomic structure a. More... | |
void | oro_atomic_set (oro_atomic_t *a, int n) |
Sets the current counter value of the atomic structure a to n. More... | |
void | oro_atomic_add (oro_atomic_t *a, int n) |
Add n to a. More... | |
int | oro_atomic_add_return (oro_atomic_t *a, int n) |
Add n to a and return the new value. More... | |
void | oro_atomic_sub (int n, oro_atomic_t *a, int n) |
Subtract n from a. More... | |
int | oro_atomic_sub_return (int n, oro_atomic_t *a, int n) |
Subtract n from a and return the new value. More... | |
int | oro_atomic_sub_and_test (oro_atomic_t *a, int n) |
Subtract n from a and test for zero. More... | |
void | oro_atomic_inc (oro_atomic_t *a) |
Increment a atomically. More... | |
int | oro_atomic_inc_return (oro_atomic_t *a) |
Increment a atomically and return the new value. More... | |
void | oro_atomic_dec (oro_atomic_t *a) |
Decrement a atomically. More... | |
int | oro_atomic_dec_return (oro_atomic_t *a) |
Decrement a atomically and return the new value. More... | |
int | oro_atomic_dec_and_test (oro_atomic_t *a) |
Decrement a atomically and test for zero. More... | |
int | oro_atomic_inc_and_test (oro_atomic_t *a) |
Increment a atomically and test for zero. More... | |
int | oro_cmpxchg (void volatile *ptr, unsigned long o, unsigned long n) |
Compare o with *ptr and swap with n if equal. More... | |
Please use this template to create new oro_arch.h files for different target architectures or compilers.
You are free to make any of these functions macros or to declare them inlined.
Do not include this header, it serves only as an example and the expected architecture-specific API of the RTT. Include oro_arch.h instead.
This interface has been inspired on the common intrinsics API's of various compilers, operating systems and processor architectures. Examples are: GCC, Visual Studio and the Intel instruction set.
Definition in file oro_arch_interface.h.
typedef struct oro_atomic_t_interface oro_atomic_t |
Definition at line 26 of file oro_arch_interface.h.
void oro_atomic_add | ( | oro_atomic_t * | a, |
int | n | ||
) |
Add n to a.
Referenced by RTT::os::AtomicInt::add().
int oro_atomic_add_return | ( | oro_atomic_t * | a, |
int | n | ||
) |
Add n to a and return the new value.
void ORO_ATOMIC_CLEANUP | ( | oro_atomic_t * | a | ) |
Cleans up all resources allocated durint the setup of atomic structure a.
Referenced by RTT::os::AtomicInt::~AtomicInt(), RTT::base::ChannelElementBase::~ChannelElementBase(), and RTT::os::SharedMutex::~SharedMutex().
void oro_atomic_dec | ( | oro_atomic_t * | a | ) |
Decrement a atomically.
Referenced by RTT::internal::ListLockFree< connection_t >::append(), RTT::internal::ListLockFree< connection_t >::apply(), RTT::internal::ListLockFree< connection_t >::apply_and_blank(), RTT::internal::ListLockFree< connection_t >::back(), RTT::internal::ListLockFree< connection_t >::capacity(), RTT::internal::ListLockFree< connection_t >::clear(), RTT::base::DataObjectLockFree< T >::clear(), RTT::os::AtomicInt::dec(), RTT::internal::ListLockFree< connection_t >::delete_if(), RTT::internal::ListLockFree< connection_t >::empty(), RTT::internal::ListLockFree< connection_t >::erase(), RTT::internal::ListLockFree< connection_t >::erase_and_blank(), RTT::internal::ListLockFree< connection_t >::find_if(), RTT::internal::ListLockFree< connection_t >::front(), RTT::base::DataObjectLockFree< T >::Get(), RTT::internal::ListLockFree< connection_t >::reserve(), RTT::base::DataObjectLockFree< T >::Set(), and RTT::internal::ListLockFree< connection_t >::size().
int oro_atomic_dec_and_test | ( | oro_atomic_t * | a | ) |
Decrement a atomically and test for zero.
Referenced by RTT::os::AtomicInt::dec_and_test(), RTT::base::ChannelElementBase::deref(), RTT::internal::intrusive_ptr_release(), and RTT::base::intrusive_ptr_release().
int oro_atomic_dec_return | ( | oro_atomic_t * | a | ) |
Decrement a atomically and return the new value.
void oro_atomic_inc | ( | oro_atomic_t * | a | ) |
Increment a atomically.
Referenced by RTT::base::DataObjectLockFree< T >::clear(), RTT::internal::ListLockFree< connection_t >::find_if(), RTT::base::DataObjectLockFree< T >::Get(), RTT::os::AtomicInt::inc(), RTT::internal::intrusive_ptr_add_ref(), RTT::base::intrusive_ptr_add_ref(), RTT::base::ChannelElementBase::ref(), and RTT::internal::ListLockFree< connection_t >::reserve().
int oro_atomic_inc_and_test | ( | oro_atomic_t * | a | ) |
Increment a atomically and test for zero.
Referenced by RTT::internal::ListLockFree< connection_t >::find_if(), RTT::os::AtomicInt::inc_and_test(), and RTT::base::DataObjectLockFree< T >::Set().
int oro_atomic_inc_return | ( | oro_atomic_t * | a | ) |
Increment a atomically and return the new value.
int oro_atomic_read | ( | oro_atomic_t * | a | ) |
Returns the current counter value of the atomic structure a.
Referenced by RTT::os::AtomicInt::AtomicInt(), RTT::os::CAS(), RTT::os::SharedMutex::lock(), RTT::os::SharedMutex::lock_shared(), RTT::os::AtomicInt::operator=(), RTT::os::AtomicInt::read(), RTT::base::DataObjectLockFree< T >::Set(), RTT::os::SharedMutex::unlock(), and RTT::os::SharedMutex::unlock_shared().
void oro_atomic_set | ( | oro_atomic_t * | a, |
int | n | ||
) |
Sets the current counter value of the atomic structure a to n.
Referenced by RTT::internal::IntrusiveStorage::IntrusiveStorage(), RTT::os::AtomicInt::operator=(), and RTT::os::AtomicInt::set().
void ORO_ATOMIC_SETUP | ( | oro_atomic_t * | a, |
int | n | ||
) |
Initializes the uninitialized atomic structure a with a counter value of 'n'.
Referenced by RTT::os::AtomicInt::AtomicInt(), RTT::base::ChannelElementBase::ChannelElementBase(), and RTT::os::SharedMutex::SharedMutex().
void oro_atomic_sub | ( | int | n, |
oro_atomic_t * | a, | ||
int | n | ||
) |
Subtract n from a.
Referenced by RTT::os::AtomicInt::sub().
int oro_atomic_sub_and_test | ( | oro_atomic_t * | a, |
int | n | ||
) |
Subtract n from a and test for zero.
Referenced by RTT::os::AtomicInt::sub_and_test().
int oro_atomic_sub_return | ( | int | n, |
oro_atomic_t * | a, | ||
int | n | ||
) |
Subtract n from a and return the new value.
int oro_cmpxchg | ( | void volatile * | ptr, |
unsigned long | o, | ||
unsigned long | n | ||
) |
Compare o with *ptr and swap with n if equal.
Note: you need to implement this function for different sizes of pointers and payloads. You will probably need to implement this function as a macro to resolve this in a way compatible with C.