23 #define _ABS_EAP_AM_MUTEX_H_ |
23 #define _ABS_EAP_AM_MUTEX_H_ |
24 |
24 |
25 #include "eap_am_types.h" |
25 #include "eap_am_types.h" |
26 #include "eap_variable_data.h" |
26 #include "eap_variable_data.h" |
27 #include "eap_am_export.h" |
27 #include "eap_am_export.h" |
|
28 // Start: added by script change_export_macros.sh. |
|
29 #if defined(EAP_NO_EXPORT_ABS_EAP_AM_MUTEX_H) |
|
30 #define EAP_CLASS_VISIBILITY_ABS_EAP_AM_MUTEX_H EAP_NONSHARABLE |
|
31 #define EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H |
|
32 #define EAP_C_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H |
|
33 #define EAP_FUNC_EXPORT_ABS_EAP_AM_MUTEX_H |
|
34 #define EAP_C_FUNC_EXPORT_ABS_EAP_AM_MUTEX_H |
|
35 #elif defined(EAP_EXPORT_ABS_EAP_AM_MUTEX_H) |
|
36 #define EAP_CLASS_VISIBILITY_ABS_EAP_AM_MUTEX_H EAP_EXPORT |
|
37 #define EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H EAP_FUNC_EXPORT |
|
38 #define EAP_C_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H EAP_C_FUNC_EXPORT |
|
39 #define EAP_FUNC_EXPORT_ABS_EAP_AM_MUTEX_H EAP_FUNC_EXPORT |
|
40 #define EAP_C_FUNC_EXPORT_ABS_EAP_AM_MUTEX_H EAP_C_FUNC_EXPORT |
|
41 #else |
|
42 #define EAP_CLASS_VISIBILITY_ABS_EAP_AM_MUTEX_H EAP_IMPORT |
|
43 #define EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H EAP_FUNC_IMPORT |
|
44 #define EAP_C_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H EAP_C_FUNC_IMPORT |
|
45 #define EAP_FUNC_EXPORT_ABS_EAP_AM_MUTEX_H |
|
46 #define EAP_C_FUNC_EXPORT_ABS_EAP_AM_MUTEX_H |
|
47 #endif |
|
48 // End: added by script change_export_macros.sh. |
28 |
49 |
29 class eap_am_mutex_reference_c; |
50 class eap_am_mutex_reference_c; |
30 |
51 |
31 // --------------------------------------------- |
52 // --------------------------------------------- |
32 |
53 |
33 /// This class is interface to mutex. |
54 /// This class is interface to mutex. |
34 class EAP_EXPORT abs_eap_am_mutex_c |
55 class EAP_CLASS_VISIBILITY_ABS_EAP_AM_MUTEX_H abs_eap_am_mutex_c |
35 { |
56 { |
36 private: |
57 private: |
37 |
58 |
38 public: |
59 public: |
39 |
60 |
40 EAP_FUNC_IMPORT virtual ~abs_eap_am_mutex_c(); |
61 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H virtual ~abs_eap_am_mutex_c(); |
41 |
62 |
42 EAP_FUNC_IMPORT abs_eap_am_mutex_c(); |
63 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H abs_eap_am_mutex_c(); |
43 |
64 |
44 // - - - - - - - - - - - - - - - - - - - - - - - - |
65 // - - - - - - - - - - - - - - - - - - - - - - - - |
45 |
66 |
46 /** |
67 /** |
47 * This function enters the mutex. Thread will block until the mutex is released |
68 * This function enters the mutex. Thread will block until the mutex is released |
48 * by other owner of the mutex. |
69 * by other owner of the mutex. |
49 */ |
70 */ |
50 EAP_FUNC_IMPORT virtual eap_status_e mutex_enter() = 0; |
71 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H virtual eap_status_e mutex_enter() = 0; |
51 |
72 |
52 /** |
73 /** |
53 * This function leaves the mutex. Other blocking thread will continue execution. |
74 * This function leaves the mutex. Other blocking thread will continue execution. |
54 */ |
75 */ |
55 EAP_FUNC_IMPORT virtual eap_status_e mutex_leave(abs_eap_am_tools_c * const m_am_tools) = 0; |
76 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H virtual eap_status_e mutex_leave(abs_eap_am_tools_c * const m_am_tools) = 0; |
56 |
77 |
57 /** |
78 /** |
58 * The mutex handle must be dublicated in Symbian operating system for each thread. |
79 * The mutex handle must be dublicated in Symbian operating system for each thread. |
59 */ |
80 */ |
60 EAP_FUNC_IMPORT virtual abs_eap_am_mutex_c * dublicate_mutex() = 0; |
81 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H virtual abs_eap_am_mutex_c * dublicate_mutex() = 0; |
61 |
82 |
62 /** |
83 /** |
63 * This function returns the flag that indicates whether the mutex is reserved. |
84 * This function returns the flag that indicates whether the mutex is reserved. |
64 * This is used in debug asserts. Those will check the mutex is really reserved when critical code is entered. |
85 * This is used in debug asserts. Those will check the mutex is really reserved when critical code is entered. |
65 */ |
86 */ |
66 EAP_FUNC_IMPORT virtual bool get_is_reserved() const = 0; |
87 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H virtual bool get_is_reserved() const = 0; |
67 |
88 |
68 /** |
89 /** |
69 * Returns the validity of the mutex. |
90 * Returns the validity of the mutex. |
70 */ |
91 */ |
71 EAP_FUNC_IMPORT virtual bool get_is_valid() const = 0; |
92 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H virtual bool get_is_valid() const = 0; |
72 |
93 |
73 #if defined(USE_EAPOL_MUTEX_SEMAPHORE_TRACES) |
94 #if defined(USE_EAPOL_MUTEX_SEMAPHORE_TRACES) |
74 EAP_FUNC_IMPORT virtual eap_am_mutex_reference_c * get_reference() const = 0; |
95 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H virtual eap_am_mutex_reference_c * get_reference() const = 0; |
75 EAP_FUNC_IMPORT virtual void set_am_tools(abs_eap_am_tools_c * const tools) = 0; |
96 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H virtual void set_am_tools(abs_eap_am_tools_c * const tools) = 0; |
76 #endif //#if defined(USE_EAPOL_MUTEX_SEMAPHORE_TRACES) |
97 #endif //#if defined(USE_EAPOL_MUTEX_SEMAPHORE_TRACES) |
77 |
98 |
78 // - - - - - - - - - - - - - - - - - - - - - - - - |
99 // - - - - - - - - - - - - - - - - - - - - - - - - |
79 |
100 |
80 }; |
101 }; |
81 |
102 |
82 // --------------------------------------------- |
103 // --------------------------------------------- |
83 |
104 |
84 /// This class defines a reference counter of a mutex. |
105 /// This class defines a reference counter of a mutex. |
85 class EAP_EXPORT eap_am_mutex_reference_c |
106 class EAP_CLASS_VISIBILITY_ABS_EAP_AM_MUTEX_H eap_am_mutex_reference_c |
86 { |
107 { |
87 |
108 |
88 private: |
109 private: |
89 |
110 |
90 /// This is the reference count to the mutex. |
111 /// This is the reference count to the mutex. |
98 eap_am_mutex_reference_c(eap_am_mutex_reference_c &source); |
119 eap_am_mutex_reference_c(eap_am_mutex_reference_c &source); |
99 const eap_am_mutex_reference_c & operator=(const eap_am_mutex_reference_c& source); |
120 const eap_am_mutex_reference_c & operator=(const eap_am_mutex_reference_c& source); |
100 |
121 |
101 public: |
122 public: |
102 |
123 |
103 EAP_FUNC_IMPORT virtual ~eap_am_mutex_reference_c(); |
124 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H virtual ~eap_am_mutex_reference_c(); |
104 |
125 |
105 EAP_FUNC_IMPORT eap_am_mutex_reference_c(); |
126 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H eap_am_mutex_reference_c(); |
106 |
127 |
107 /** |
128 /** |
108 * This function adds one reference to the mutex. |
129 * This function adds one reference to the mutex. |
109 */ |
130 */ |
110 EAP_FUNC_IMPORT void add_reference(); |
131 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H void add_reference(); |
111 |
132 |
112 /** |
133 /** |
113 * This function removes one reference to the mutex. |
134 * This function removes one reference to the mutex. |
114 */ |
135 */ |
115 EAP_FUNC_IMPORT void remove_reference(); |
136 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H void remove_reference(); |
116 |
137 |
117 /** |
138 /** |
118 * This function returns the reference count of the mutex. |
139 * This function returns the reference count of the mutex. |
119 */ |
140 */ |
120 EAP_FUNC_IMPORT u32_t get_reference_count(); |
141 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H u32_t get_reference_count(); |
121 |
142 |
122 /** |
143 /** |
123 * This function sets the flag that indicates whether the mutex is reserved. |
144 * This function sets the flag that indicates whether the mutex is reserved. |
124 */ |
145 */ |
125 EAP_FUNC_IMPORT void set_is_reserved(const bool is_reserved); |
146 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H void set_is_reserved(const bool is_reserved); |
126 |
147 |
127 /** |
148 /** |
128 * This function returns the flag that indicates whether the mutex is reserved. |
149 * This function returns the flag that indicates whether the mutex is reserved. |
129 * This is used in debug asserts. Those will check the mutex is really reserved when critical code is entered. |
150 * This is used in debug asserts. Those will check the mutex is really reserved when critical code is entered. |
130 */ |
151 */ |
131 EAP_FUNC_IMPORT bool get_is_reserved(); |
152 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H bool get_is_reserved(); |
132 }; |
153 }; |
133 |
154 |
134 // --------------------------------------------- |
155 // --------------------------------------------- |
135 |
156 |
136 /// This class is base of the mutex. |
157 /// This class is base of the mutex. |
137 class EAP_EXPORT eap_am_mutex_base_c |
158 class EAP_CLASS_VISIBILITY_ABS_EAP_AM_MUTEX_H eap_am_mutex_base_c |
138 { |
159 { |
139 private: |
160 private: |
140 |
161 |
141 eap_am_mutex_reference_c * m_reference; |
162 eap_am_mutex_reference_c * m_reference; |
142 |
163 |
146 eap_am_mutex_base_c(eap_am_mutex_base_c &source); |
167 eap_am_mutex_base_c(eap_am_mutex_base_c &source); |
147 const eap_am_mutex_base_c & operator=(const eap_am_mutex_base_c& source); |
168 const eap_am_mutex_base_c & operator=(const eap_am_mutex_base_c& source); |
148 |
169 |
149 public: |
170 public: |
150 |
171 |
151 EAP_FUNC_IMPORT virtual ~eap_am_mutex_base_c(); |
172 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H virtual ~eap_am_mutex_base_c(); |
152 |
173 |
153 EAP_FUNC_IMPORT eap_am_mutex_base_c(); |
174 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H eap_am_mutex_base_c(); |
154 |
175 |
155 EAP_FUNC_IMPORT eap_am_mutex_base_c(const eap_am_mutex_base_c * const owner); |
176 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H eap_am_mutex_base_c(const eap_am_mutex_base_c * const owner); |
156 |
177 |
157 /** |
178 /** |
158 * This function returns pointer to the reference counter object of the mutex. |
179 * This function returns pointer to the reference counter object of the mutex. |
159 */ |
180 */ |
160 EAP_FUNC_IMPORT eap_am_mutex_reference_c * get_reference() const; |
181 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H eap_am_mutex_reference_c * get_reference() const; |
161 |
182 |
162 // - - - - - - - - - - - - - - - - - - - - - - - - |
183 // - - - - - - - - - - - - - - - - - - - - - - - - |
163 |
184 |
164 /** |
185 /** |
165 * This function returns the flag that indicates whether the mutex is reserved. |
186 * This function returns the flag that indicates whether the mutex is reserved. |
166 * This is used in debug asserts. Those will check the mutex is really reserved when critical code is entered. |
187 * This is used in debug asserts. Those will check the mutex is really reserved when critical code is entered. |
167 */ |
188 */ |
168 EAP_FUNC_IMPORT bool get_is_reserved() const; |
189 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H bool get_is_reserved() const; |
169 |
190 |
170 /** |
191 /** |
171 * Returns the validity of the mutex. |
192 * Returns the validity of the mutex. |
172 */ |
193 */ |
173 EAP_FUNC_IMPORT bool get_is_valid() const; |
194 EAP_FUNC_VISIBILITY_ABS_EAP_AM_MUTEX_H bool get_is_valid() const; |
174 |
195 |
175 // - - - - - - - - - - - - - - - - - - - - - - - - |
196 // - - - - - - - - - - - - - - - - - - - - - - - - |
176 |
197 |
177 }; |
198 }; |
178 |
199 |