| 1 | // Copyright 2009-2021 Intel Corporation | 
|---|
| 2 | // SPDX-License-Identifier: Apache-2.0 | 
|---|
| 3 |  | 
|---|
| 4 | #pragma once | 
|---|
| 5 |  | 
|---|
| 6 | #include "mutex.h" | 
|---|
| 7 |  | 
|---|
| 8 | namespace embree | 
|---|
| 9 | { | 
|---|
| 10 | class ConditionSys | 
|---|
| 11 | { | 
|---|
| 12 | public: | 
|---|
| 13 | ConditionSys(); | 
|---|
| 14 | ~ConditionSys(); | 
|---|
| 15 | void wait( class MutexSys& mutex ); | 
|---|
| 16 | void notify_all(); | 
|---|
| 17 |  | 
|---|
| 18 | template<typename Predicate> | 
|---|
| 19 | __forceinline void wait( class MutexSys& mutex, const Predicate& pred ) | 
|---|
| 20 | { | 
|---|
| 21 | while (!pred()) wait(mutex); | 
|---|
| 22 | } | 
|---|
| 23 |  | 
|---|
| 24 | private: | 
|---|
| 25 | ConditionSys (const ConditionSys& other) DELETED; // do not implement | 
|---|
| 26 | ConditionSys& operator= (const ConditionSys& other) DELETED; // do not implement | 
|---|
| 27 |  | 
|---|
| 28 | protected: | 
|---|
| 29 | void* cond; | 
|---|
| 30 | }; | 
|---|
| 31 | } | 
|---|
| 32 |  | 
|---|