2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FBaseRtWaitingLoop.cpp
20 * @brief This is the implementation for the %WaitingLoop class.
24 #include <FBaseRtWaitingLoop.h>
25 #include "FBaseRt_WaitingLoopImpl.h"
27 namespace Tizen { namespace Base { namespace Runtime
30 WaitingLoop::WaitingLoop(void)
31 : __pWaitingLoopImpl(null)
36 WaitingLoop::~WaitingLoop(void)
38 delete __pWaitingLoopImpl;
42 WaitingLoop::GetInstance(void)
44 static WaitingLoop* pWaitingLoop = null;
45 if (pWaitingLoop == null)
47 pWaitingLoop = _WaitingLoopImpl::GetInstanceN();
51 if (pWaitingLoop->__pWaitingLoopImpl->IsSameThread() == false)
53 pWaitingLoop->__pWaitingLoopImpl->Notify();
56 pWaitingLoop = _WaitingLoopImpl::GetInstanceN();
64 WaitingLoop::Wait(int timeout)
66 return __pWaitingLoopImpl->Wait(timeout);
70 WaitingLoop::Wait(IWaitingLoopCondition& condition)
72 return __pWaitingLoopImpl->Wait(condition);
76 WaitingLoop::Wait(int timeout, IWaitingLoopCondition& condition)
78 return __pWaitingLoopImpl->Wait(timeout, condition);
82 WaitingLoop::Notify(void)
84 __pWaitingLoopImpl->Notify();
88 WaitingLoop::SetMaxTimeoutForWaiting(int timeout)
90 WaitingLoop* pWaitingLoop = WaitingLoop::GetInstance();
92 if (pWaitingLoop != null)
94 pWaitingLoop->__pWaitingLoopImpl->SetMaxTimeoutForWaiting(timeout);
98 }}} // Tizen::Base::Runtime