Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_CPPU_SOURCE_THREADPOOL_THREAD_HXX
20 : #define INCLUDED_CPPU_SOURCE_THREADPOOL_THREAD_HXX
21 :
22 : #include <osl/thread.hxx>
23 : #include <sal/types.h>
24 : #include <salhelper/simplereferenceobject.hxx>
25 :
26 : #include "jobqueue.hxx"
27 : #include "threadpool.hxx"
28 :
29 : namespace cppu_threadpool {
30 :
31 : class JobQueue;
32 :
33 :
34 : // private thread class for the threadpool
35 :
36 : class ORequestThread:
37 : public salhelper::SimpleReferenceObject, public osl::Thread
38 : {
39 : public:
40 : ORequestThread( ThreadPoolHolder const &aThreadPool,
41 : JobQueue * ,
42 : const ::rtl::ByteSequence &aThreadId,
43 : bool bAsynchron );
44 : virtual ~ORequestThread();
45 :
46 : void setTask( JobQueue * , const ::rtl::ByteSequence & aThreadId , bool bAsynchron );
47 :
48 : bool launch();
49 :
50 907 : static inline void * operator new(std::size_t size)
51 907 : { return SimpleReferenceObject::operator new(size); }
52 :
53 907 : static inline void operator delete(void * pointer)
54 907 : { SimpleReferenceObject::operator delete(pointer); }
55 :
56 : private:
57 : virtual void SAL_CALL run() SAL_OVERRIDE;
58 : virtual void SAL_CALL onTerminated() SAL_OVERRIDE;
59 :
60 : ThreadPoolHolder m_aThreadPool;
61 : JobQueue *m_pQueue;
62 : ::rtl::ByteSequence m_aThreadId;
63 : bool m_bAsynchron;
64 : };
65 :
66 : } // end cppu_threadpool
67 :
68 :
69 : #endif
70 :
71 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|