Update ooo320-m1
[ooovba.git] / desktop / source / deployment / gui / dp_gui_thread.hxx
blobce487efbb4ff171f93b288024bf0b4d1e941d1ad
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dp_gui_thread.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_THREAD_HXX
32 #define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_THREAD_HXX
34 #include "sal/config.h"
36 #include <cstddef>
37 #include <new>
38 #include "osl/thread.hxx"
39 #include "sal/types.h"
40 #include "salhelper/simplereferenceobject.hxx"
42 /// @HTML
44 namespace dp_gui {
46 /**
47 A safe encapsulation of <code>osl::Thread</code>.
49 class Thread: public salhelper::SimpleReferenceObject, private osl::Thread {
50 public:
51 Thread();
53 /**
54 Launch the thread.
56 <p>This function must be called at most once.</p>
58 void launch();
60 using osl::Thread::join;
62 static void * operator new(std::size_t size) throw (std::bad_alloc);
64 static void operator delete(void * p) throw ();
66 protected:
67 virtual ~Thread();
69 /**
70 The main function executed by the thread.
72 <p>Any exceptions terminate the thread and are effectively ignored.</p>
74 virtual void execute() = 0;
76 private:
77 Thread(Thread &); // not defined
78 void operator =(Thread &); // not defined
80 virtual void SAL_CALL run();
82 virtual void SAL_CALL onTerminated();
87 #endif