1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #ifndef INCLUDED_SW_SOURCE_CORE_INC_SWTHREADMANAGER_HXX
20 #define INCLUDED_SW_SOURCE_CORE_INC_SWTHREADMANAGER_HXX
22 #include <osl/interlck.h>
26 namespace rtl
{ template <class reference_type
> class Reference
; }
28 class ObservableThread
;
31 /** class to manage threads in Writer using a <ThreadManager> instance
34 Conforms the singleton pattern
40 static SwThreadManager
& GetThreadManager();
42 static bool ExistsThreadManager();
44 // private: don't call!
46 // private: don't call!
49 oslInterlockedCount
AddThread( const rtl::Reference
< ObservableThread
>& rThread
);
51 void RemoveThread( const oslInterlockedCount nThreadID
);
53 /** suspend the starting of threads
55 Suspending the starting of further threads is sensible during the
56 destruction of a Writer document.
58 void SuspendStartingOfThreads();
60 /** continues the starting of threads after it has been suspended
62 void ResumeStartingOfThreads();
64 bool StartingOfThreadsSuspended();
68 SwThreadManager(SwThreadManager
const&) = delete;
69 SwThreadManager
& operator=(SwThreadManager
const&) = delete;
71 static bool sbThreadManagerInstantiated
;
73 std::unique_ptr
<ThreadManager
> mpThreadManagerImpl
;
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */