2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FBaseRtWaitingLoop.cpp
19 * @brief This is the implementation for the %WaitingLoop class.
23 #include <FBaseRtWaitingLoop.h>
24 #include "FBaseRt_WaitingLoopImpl.h"
26 namespace Tizen { namespace Base { namespace Runtime
29 WaitingLoop::WaitingLoop(void)
30 : __pWaitingLoopImpl(null)
35 WaitingLoop::~WaitingLoop(void)
37 delete __pWaitingLoopImpl;
41 WaitingLoop::GetInstance(void)
43 static WaitingLoop* pWaitingLoop = null;
44 if (pWaitingLoop == null)
46 pWaitingLoop = _WaitingLoopImpl::GetInstanceN();
50 if (pWaitingLoop->__pWaitingLoopImpl->IsSameThread() == false)
52 pWaitingLoop->__pWaitingLoopImpl->Notify();
55 pWaitingLoop = _WaitingLoopImpl::GetInstanceN();
63 WaitingLoop::Wait(int timeout)
65 return __pWaitingLoopImpl->Wait(timeout);
69 WaitingLoop::Wait(IWaitingLoopCondition& condition)
71 return __pWaitingLoopImpl->Wait(condition);
75 WaitingLoop::Wait(int timeout, IWaitingLoopCondition& condition)
77 return __pWaitingLoopImpl->Wait(timeout, condition);
81 WaitingLoop::Notify(void)
83 __pWaitingLoopImpl->Notify();
87 WaitingLoop::SetMaxTimeoutForWaiting(int timeout)
89 WaitingLoop* pWaitingLoop = WaitingLoop::GetInstance();
91 if (pWaitingLoop != null)
93 pWaitingLoop->__pWaitingLoopImpl->SetMaxTimeoutForWaiting(timeout);
97 }}} // Tizen::Base::Runtime