1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_
25 #define __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_
26 
27 //_________________________________________________________________________________________________________________
28 //	my own includes
29 //_________________________________________________________________________________________________________________
30 
31 #include <threadhelp/lockhelper.hxx>
32 
33 //_________________________________________________________________________________________________________________
34 //	interface includes
35 //_________________________________________________________________________________________________________________
36 
37 //_________________________________________________________________________________________________________________
38 //	other includes
39 //_________________________________________________________________________________________________________________
40 
41 //_________________________________________________________________________________________________________________
42 //	namespace
43 //_________________________________________________________________________________________________________________
44 
45 namespace framework{
46 
47 //_________________________________________________________________________________________________________________
48 //	const
49 //_________________________________________________________________________________________________________________
50 
51 //_________________________________________________________________________________________________________________
52 //	declarations
53 //_________________________________________________________________________________________________________________
54 
55 /*-************************************************************************************************************//**
56     @short          "baseclass" to make own classes threadsafe
57     @descr          Sometimes you must share your lock- or mutex member with any other baseclasses.
58                     And baseclasses are initialized erlier then members! That's why you should use
59                     this struct as first of your baseclasses!!!
60                     Then you will get a public member "m_aLock" which can be used by special guard implementations
61                     to make your code threadsafe.
62 
63     @seealso        class LockHelper
64 
65 	@implements		-
66 	@base			-
67 
68 	@devstatus		ready to use
69 *//*-*************************************************************************************************************/
70 struct ThreadHelpBase
71 {
72     //-------------------------------------------------------------------------------------------------------------
73     //  public methods
74     //-------------------------------------------------------------------------------------------------------------
75     public:
ThreadHelpBaseframework::ThreadHelpBase76         ThreadHelpBase( ::vos::IMutex* pSolarMutex = NULL )
77                 :   m_aLock( pSolarMutex )
78         {
79         }
80 
81     //-------------------------------------------------------------------------------------------------------------
82     //  public member
83     //  Make it mutable for using in const functions!
84     //-------------------------------------------------------------------------------------------------------------
85     public:
86 
87         mutable LockHelper m_aLock;
88 };
89 
90 }		//	namespace framework
91 
92 #endif  //  #ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_
93