1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef _CPPU_THREADPOOL_JOBQUEUE_HXX_
29 #define _CPPU_THREADPOOL_JOBQUEUE_HXX_
32 #include <sal/types.h>
34 #include <osl/conditn.h>
35 #include <osl/mutex.hxx>
37 #include <boost/shared_ptr.hpp>
39 namespace cppu_threadpool
41 extern "C" typedef void (SAL_CALL RequestFun
)(void *);
45 void *pThreadSpecificData
;
46 RequestFun
* doRequest
;
49 typedef ::std::list
< struct Job
> JobList
;
51 typedef ::std::list
< sal_Int64
> CallStackList
;
53 class DisposedCallerAdmin
;
54 typedef boost::shared_ptr
<DisposedCallerAdmin
> DisposedCallerAdminHolder
;
62 void add( void *pThreadSpecificData
, RequestFun
* doRequest
);
64 void *enter( sal_Int64 nDisposeId
, sal_Bool bReturnWhenNoJob
= sal_False
);
65 void dispose( sal_Int64 nDisposeId
);
71 sal_Bool
isCallstackEmpty();
77 CallStackList m_lstCallstack
;
79 sal_Bool m_bSuspended
;
80 oslCondition m_cndWait
;
81 DisposedCallerAdminHolder m_DisposedCallerAdmin
;