bump product version to 4.1.6.2
[LibreOffice.git] / framework / inc / helper / wakeupthread.hxx
blob0541082012947fe38b542dce4297526871d5755b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef __FRAMEWORK_HELPER_WAKEUPTHREAD_HXX_
21 #define __FRAMEWORK_HELPER_WAKEUPTHREAD_HXX_
23 //_______________________________________________
24 // include files of own module
26 #include <threadhelp/threadhelpbase.hxx>
27 #include <macros/debug.hxx>
28 #include <macros/generic.hxx>
30 #include <general.h>
32 //_______________________________________________
33 // include UNO interfaces
35 #include <com/sun/star/util/XUpdatable.hpp>
37 //_______________________________________________
38 // include all others
39 #include <cppuhelper/weakref.hxx>
40 #include <osl/thread.hxx>
43 namespace framework{
46 //===============================================
47 /** @short implements a "sleeping" thread, which try to sleep
48 without a using cpu consumption :-) */
49 class WakeUpThread : public ThreadHelpBase
50 , public ::osl::Thread
52 //-------------------------------------------
53 // member
54 private:
56 /** @short this listener will be notified if this thread
57 waked up. */
58 css::uno::WeakReference< css::util::XUpdatable > m_xListener;
60 //-------------------------------------------
61 // interface
62 public:
64 /** @short Register a new listener on this thread.
66 @descr The listener is holded as a weak reference.
67 If the thread detects, that no listener exists ...
68 he will terminate itself.
70 WakeUpThread(const css::uno::Reference< css::util::XUpdatable >& xListener);
72 /** @descr The thread waits on a condition using a fix timeout value.
73 If the thread wakes up he notify the internal set listener.
74 The listener can use this "timeout" info for it's own purpose.
75 The thread itself will wait on the condition again.
77 virtual void SAL_CALL run();
79 virtual void SAL_CALL onTerminated();
82 } // namespace framework
84 #endif // __FRAMEWORK_HELPER_WAKEUPTHREAD_HXX_
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */