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 _CPPU_THREADPOOL_THREAD_HXX
20 : #define _CPPU_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 : // independent from vos
36 :
37 : class ORequestThread:
38 : public salhelper::SimpleReferenceObject, public osl::Thread
39 : {
40 : public:
41 : ORequestThread( ThreadPoolHolder const &aThreadPool,
42 : JobQueue * ,
43 : const ::rtl::ByteSequence &aThreadId,
44 : bool bAsynchron );
45 : virtual ~ORequestThread();
46 :
47 : void setTask( JobQueue * , const ::rtl::ByteSequence & aThreadId , bool bAsynchron );
48 :
49 : void launch();
50 :
51 0 : static inline void * operator new(std::size_t size)
52 0 : { return SimpleReferenceObject::operator new(size); }
53 :
54 0 : static inline void operator delete(void * pointer)
55 0 : { SimpleReferenceObject::operator delete(pointer); }
56 :
57 : private:
58 : virtual void SAL_CALL run() SAL_OVERRIDE;
59 : virtual void SAL_CALL onTerminated() SAL_OVERRIDE;
60 :
61 : ThreadPoolHolder m_aThreadPool;
62 : JobQueue *m_pQueue;
63 : ::rtl::ByteSequence m_aThreadId;
64 : bool m_bAsynchron;
65 : };
66 :
67 : } // end cppu_threadpool
68 :
69 :
70 : #endif
71 :
72 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|