template experiment, PIMutex recursive in all systems
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
* @param v is input parameter of type T
|
||||
* @return true if zero, false if not zero
|
||||
*/
|
||||
template<typename T>
|
||||
template<typename T, typename std::enable_if<std::is_floating_point<T>::value, int>::type = 0>
|
||||
inline bool _PIMathMatrixNullCompare(const T v) {
|
||||
static_assert(std::is_floating_point<T>::value, "Type must be floating point");
|
||||
return (piAbs(v) < T(1E-200));
|
||||
@@ -46,22 +46,16 @@ inline bool _PIMathMatrixNullCompare(const T v) {
|
||||
* @param v is input parameter of type colmplexf
|
||||
* @return true if zero, false if not zero
|
||||
*/
|
||||
template<>
|
||||
inline bool _PIMathMatrixNullCompare<complexf>(const complexf v) {
|
||||
template<typename T,typename std::enable_if<
|
||||
std::is_floating_point<decltype(T::real)>::value ||
|
||||
std::is_floating_point<decltype(T::imag)>::value
|
||||
, int>::type = 0>
|
||||
inline bool _PIMathMatrixNullCompare(const T v) {
|
||||
static_assert(std::is_floating_point<decltype(v.real)>::value, "Type must be floating point");
|
||||
static_assert(std::is_floating_point<decltype(v.imag)>::value, "Type must be floating point");
|
||||
return (abs(v) < float(1E-200));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Inline funtion of compare with zero complexd type
|
||||
*
|
||||
* @param v is input parameter of type colmplexd
|
||||
* @return true if zero, false if not zero
|
||||
*/
|
||||
template<>
|
||||
inline bool _PIMathMatrixNullCompare<complexd>(const complexd v) {
|
||||
return (abs(v) < double(1E-200));
|
||||
}
|
||||
|
||||
|
||||
/// Matrix templated
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ void PIMutex::init() {
|
||||
pthread_mutexattr_t attr;
|
||||
memset(&attr, 0, sizeof(attr));
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
memset(&(PRIVATE->mutex), 0, sizeof(PRIVATE->mutex));
|
||||
pthread_mutex_init(&(PRIVATE->mutex), &attr);
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
|
||||
Reference in New Issue
Block a user