X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fdevel-api%2Fthreading%2Fconditional-wait.h;h=24a087449f85a4056db320492fad4dd18a791547;hb=7a1f352e7a7c8bb4bed52e78db3960e54c1fd350;hp=4315fed8e5577ec2f7423388a3865699186f97e6;hpb=4468cbf6d9b84a613616f25970c64d843ce91d34;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/devel-api/threading/conditional-wait.h b/dali/devel-api/threading/conditional-wait.h index 4315fed..24a0874 100644 --- a/dali/devel-api/threading/conditional-wait.h +++ b/dali/devel-api/threading/conditional-wait.h @@ -2,7 +2,7 @@ #define __DALI_CONDITIONAL_WAIT_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ namespace Dali /** * Helper class to allow conditional waiting and notifications between multiple threads. */ -class DALI_IMPORT_API ConditionalWait +class DALI_CORE_API ConditionalWait { public: @@ -55,15 +55,18 @@ public: * Getter for the ConditionalWait locked for this instance's lifetime. * @return the ConditionalWait object currently locked. */ - ConditionalWait& GetLockedWait() const { return mWait; } + ConditionalWait& GetLockedWait() const; + + public: // Data, public to allow nesting class to access + + struct ScopedLockImpl; + ScopedLockImpl* mImpl; private: // Not implemented as ScopedLock cannot be copied: ScopedLock( const ScopedLock& ); const ScopedLock& operator=( const ScopedLock& ); - - ConditionalWait& mWait; }; /** @@ -85,6 +88,18 @@ public: void Notify(); /** + * @brief Notifies another thread to continue if it is blocked on a wait. + * + * Assumes that the ScopedLock object passed in has already locked the internal state of + * this object. + * Can be called from any thread. + * Does not block the current thread but may cause a rescheduling of threads. + * + * @param[in] scope A pre-existing lock on the internal state of this object. + */ + void Notify( const ScopedLock& scope ); + + /** * @brief Wait for another thread to notify us when the condition is true and we can continue * * Will always block current thread until Notify is called @@ -98,7 +113,7 @@ public: * Assumes that the ScopedLock object passed in has already locked the internal state of * this object. Releases the lock while waiting and re-acquires it when returning * from the wait. - * param[in] scope A pre-existing lock on the internal state of this object. + * @param[in] scope A pre-existing lock on the internal state of this object. * @pre scope must have been passed this ConditionalWait during its construction. */ void Wait( const ScopedLock& scope );