Ejemplo n.º 1
0
 inline MutexImplPosix() {
   if (RECURSIVE) {
     DO_AND_DEBUG_ASSERT_ZERO(pthread_mutex_init(&internal_mutex_,
                                                 threading_posix_internal::kMutexattrRecursive));
   } else {
     DO_AND_DEBUG_ASSERT_ZERO(pthread_mutex_init(&internal_mutex_,
                                                 threading_posix_internal::kMutexattrNormal));
   }
 }
Ejemplo n.º 2
0
 explicit MutexAttrWrapper(bool recursive) {
   DO_AND_DEBUG_ASSERT_ZERO(pthread_mutexattr_init(&internal_mutex_attr_));
   if (recursive) {
     DO_AND_DEBUG_ASSERT_ZERO(pthread_mutexattr_settype(&internal_mutex_attr_,
                                                        PTHREAD_MUTEX_RECURSIVE));
   } else {
     DO_AND_DEBUG_ASSERT_ZERO(pthread_mutexattr_settype(&internal_mutex_attr_,
                                                        PTHREAD_MUTEX_NORMAL));
   }
 }
void StorageManager::deallocateSlots(void *slots, const std::size_t num_slots) {
#if defined(QUICKSTEP_HAVE_MMAP_LINUX_HUGETLB) \
    || defined(QUICKSTEP_HAVE_MMAP_BSD_SUPERPAGE) \
    || defined(QUICKSTEP_HAVE_MMAP_PLAIN)
  DO_AND_DEBUG_ASSERT_ZERO(munmap(slots, num_slots * kSlotSizeBytes));
#else
  free(slots);
#endif
  total_memory_usage_ -= num_slots;
}
Ejemplo n.º 4
0
 inline void unlock() {
   DO_AND_DEBUG_ASSERT_ZERO(pthread_mutex_unlock(&internal_mutex_));
 }
Ejemplo n.º 5
0
 inline ~MutexImplPosix() {
   DO_AND_DEBUG_ASSERT_ZERO(pthread_mutex_destroy(&internal_mutex_));
 }
Ejemplo n.º 6
0
 inline void signalAll() {
     DO_AND_DEBUG_ASSERT_ZERO(pthread_cond_broadcast(&internal_condition_var_));
 }
Ejemplo n.º 7
0
 explicit ConditionVariableImplPosix(pthread_mutex_t *parent_mutex)
     : parent_mutex_(parent_mutex) {
     DO_AND_DEBUG_ASSERT_ZERO(pthread_cond_init(&internal_condition_var_, nullptr));
 }
Ejemplo n.º 8
0
 inline void await() {
     DO_AND_DEBUG_ASSERT_ZERO(pthread_cond_wait(&internal_condition_var_, parent_mutex_));
 }
Ejemplo n.º 9
0
 inline void signalOne() {
     DO_AND_DEBUG_ASSERT_ZERO(pthread_cond_signal(&internal_condition_var_));
 }
Ejemplo n.º 10
0
 ~ConditionVariableImplPosix() {
     DO_AND_DEBUG_ASSERT_ZERO(pthread_cond_destroy(&internal_condition_var_));
 }
Ejemplo n.º 11
0
 inline void unlockShared() {
   DO_AND_DEBUG_ASSERT_ZERO(pthread_rwlock_unlock(&internal_rwlock_));
 }
Ejemplo n.º 12
0
 inline void lock() {
   DO_AND_DEBUG_ASSERT_ZERO(pthread_rwlock_wrlock(&internal_rwlock_));
 }
Ejemplo n.º 13
0
 inline ~SharedMutexImplPosix() {
   DO_AND_DEBUG_ASSERT_ZERO(pthread_rwlock_destroy(&internal_rwlock_));
 }
Ejemplo n.º 14
0
 inline SharedMutexImplPosix() {
   DO_AND_DEBUG_ASSERT_ZERO(pthread_rwlock_init(&internal_rwlock_, nullptr));
 }