Remove de-funct Bullet dynamics plugin
[platform/core/uifw/dali-adaptor.git] / adaptors / base / conditional-wait.h
1 #ifndef __DALI_INTERNAL_CONDITIONAL_WAIT_H__
2 #define __DALI_INTERNAL_CONDITIONAL_WAIT_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 namespace Dali
22 {
23
24 namespace Internal
25 {
26
27 namespace Adaptor
28 {
29
30 /**
31  * Helper class to allow conditional waiting and notifications between multiple threads
32  */
33 class ConditionalWait
34 {
35 public:
36
37   /**
38    * @brief Constructor, creates the internal synchronization objects
39    */
40   ConditionalWait();
41
42   /**
43    * @brief Destructor, non-virtual as this is not a base class
44    */
45   ~ConditionalWait();
46
47   /**
48    * @brief Notifies another thread to continue if it is blocked on a wait.
49    *
50    * Can be called from any thread.
51    * Does not block the current thread but may cause a rescheduling of threads.
52    */
53   void Notify();
54
55   /**
56    * @brief Wait for another thread to notify us when the condition is true and we can continue
57    *
58    * Will always block current thread until Notify is called
59    */
60   void Wait();
61
62   /**
63    * @brief Return the count of threads waiting for this conditional
64    * @return count of waits
65    */
66   unsigned int GetWaitCount() const;
67
68 private:
69
70   /// Not implemented as ConditionalWait is not copyable
71   ConditionalWait( const ConditionalWait& );
72   const ConditionalWait& operator= ( const ConditionalWait& );
73
74   struct ConditionalWaitImpl;
75   ConditionalWaitImpl* mImpl;
76
77 };
78
79 } // namespace Adaptor
80
81 } // namespace Internal
82
83 } // namespace Dali
84
85 #endif // __DALI_INTERNAL_CONDITIONAL_WAIT_H__