eapol/eapol_framework/eapol_common/am/include/abs_eap_am_semaphore.h
changeset 52 c23bdf5a328a
parent 33 938269283a16
equal deleted inserted replaced
51:e863583e6720 52:c23bdf5a328a
    23 #define _ABS_EAP_AM_SEMAPHORE_H_
    23 #define _ABS_EAP_AM_SEMAPHORE_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_SEMAPHORE_H)
       
    30 	#define EAP_CLASS_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H EAP_NONSHARABLE 
       
    31 	#define EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H 
       
    32 	#define EAP_C_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H 
       
    33 	#define EAP_FUNC_EXPORT_ABS_EAP_AM_SEMAPHORE_H 
       
    34 	#define EAP_C_FUNC_EXPORT_ABS_EAP_AM_SEMAPHORE_H 
       
    35 #elif defined(EAP_EXPORT_ABS_EAP_AM_SEMAPHORE_H)
       
    36 	#define EAP_CLASS_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H EAP_EXPORT 
       
    37 	#define EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H EAP_FUNC_EXPORT 
       
    38 	#define EAP_C_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H EAP_C_FUNC_EXPORT 
       
    39 	#define EAP_FUNC_EXPORT_ABS_EAP_AM_SEMAPHORE_H EAP_FUNC_EXPORT 
       
    40 	#define EAP_C_FUNC_EXPORT_ABS_EAP_AM_SEMAPHORE_H EAP_C_FUNC_EXPORT 
       
    41 #else
       
    42 	#define EAP_CLASS_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H EAP_IMPORT 
       
    43 	#define EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H EAP_FUNC_IMPORT 
       
    44 	#define EAP_C_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H EAP_C_FUNC_IMPORT 
       
    45 	#define EAP_FUNC_EXPORT_ABS_EAP_AM_SEMAPHORE_H 
       
    46 	#define EAP_C_FUNC_EXPORT_ABS_EAP_AM_SEMAPHORE_H 
       
    47 #endif
       
    48 // End: added by script change_export_macros.sh.
    28 
    49 
    29 class eap_am_semaphore_reference_c;
    50 class eap_am_semaphore_reference_c;
    30 
    51 
    31 // ---------------------------------------------
    52 // ---------------------------------------------
    32 
    53 
    33 /// This class is interface to semaphore.
    54 /// This class is interface to semaphore.
    34 class EAP_EXPORT abs_eap_am_semaphore_c
    55 class EAP_CLASS_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H abs_eap_am_semaphore_c
    35 {
    56 {
    36 private:
    57 private:
    37 
    58 
    38 public:
    59 public:
    39 
    60 
    40 	EAP_FUNC_IMPORT virtual ~abs_eap_am_semaphore_c();
    61 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H virtual ~abs_eap_am_semaphore_c();
    41 
    62 
    42 	EAP_FUNC_IMPORT abs_eap_am_semaphore_c();
    63 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H abs_eap_am_semaphore_c();
    43 
    64 
    44 	// - - - - - - - - - - - - - - - - - - - - - - - -
    65 	// - - - - - - - - - - - - - - - - - - - - - - - -
    45 
    66 
    46 	/**
    67 	/**
    47 	 * This function reserves the semaphore. Thread will block until the semaphore is released
    68 	 * This function reserves the semaphore. Thread will block until the semaphore is released
    48 	 * by other owner of the semaphore.
    69 	 * by other owner of the semaphore.
    49 	 */
    70 	 */
    50 	EAP_FUNC_IMPORT virtual eap_status_e semaphore_reserve() = 0;
    71 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H virtual eap_status_e semaphore_reserve() = 0;
    51 
    72 
    52 	/**
    73 	/**
    53 	 * This function releases the semaphore. Other blocking thread will continue execution.
    74 	 * This function releases the semaphore. Other blocking thread will continue execution.
    54 	 */
    75 	 */
    55 	EAP_FUNC_IMPORT virtual eap_status_e semaphore_release() = 0;
    76 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H virtual eap_status_e semaphore_release() = 0;
    56 
    77 
    57 	/**
    78 	/**
    58 	 * The semaphore handle must be dublicated in Symbian operating system for each thread.
    79 	 * The semaphore handle must be dublicated in Symbian operating system for each thread.
    59 	 */
    80 	 */
    60 	EAP_FUNC_IMPORT virtual abs_eap_am_semaphore_c * dublicate_semaphore() = 0;
    81 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H virtual abs_eap_am_semaphore_c * dublicate_semaphore() = 0;
    61 
    82 
    62 	EAP_FUNC_IMPORT virtual u32_t get_count() const = 0;
    83 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H virtual u32_t get_count() const = 0;
    63 
    84 
    64 	/**
    85 	/**
    65 	 * Returns the validity of the semaphore.
    86 	 * Returns the validity of the semaphore.
    66 	 */
    87 	 */
    67 	EAP_FUNC_IMPORT virtual bool get_is_valid() const = 0;
    88 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H virtual bool get_is_valid() const = 0;
    68 
    89 
    69 #if defined(USE_EAPOL_MUTEX_SEMAPHORE_TRACES)
    90 #if defined(USE_EAPOL_MUTEX_SEMAPHORE_TRACES)
    70 	EAP_FUNC_IMPORT virtual eap_am_semaphore_reference_c * get_reference() const = 0;
    91 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H virtual eap_am_semaphore_reference_c * get_reference() const = 0;
    71 	EAP_FUNC_IMPORT virtual void set_am_tools(abs_eap_am_tools_c * const tools) = 0;
    92 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H virtual void set_am_tools(abs_eap_am_tools_c * const tools) = 0;
    72 #endif //#if defined(USE_EAPOL_MUTEX_SEMAPHORE_TRACES)
    93 #endif //#if defined(USE_EAPOL_MUTEX_SEMAPHORE_TRACES)
    73 
    94 
    74 	// - - - - - - - - - - - - - - - - - - - - - - - -
    95 	// - - - - - - - - - - - - - - - - - - - - - - - -
    75 
    96 
    76 };
    97 };
    77 
    98 
    78 // ---------------------------------------------
    99 // ---------------------------------------------
    79 
   100 
    80 /// This class defines a reference counter of a semaphore.
   101 /// This class defines a reference counter of a semaphore.
    81 class EAP_EXPORT eap_am_semaphore_reference_c
   102 class EAP_CLASS_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H eap_am_semaphore_reference_c
    82 {
   103 {
    83 
   104 
    84 private:
   105 private:
    85 
   106 
    86 	/// This is the reference count to the semaphore.
   107 	/// This is the reference count to the semaphore.
    87 	u32_t m_reference_count;
   108 	u32_t m_reference_count;
    88 
   109 
    89 public:
   110 public:
    90 
   111 
    91 	EAP_FUNC_IMPORT virtual ~eap_am_semaphore_reference_c();
   112 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H virtual ~eap_am_semaphore_reference_c();
    92 
   113 
    93 	EAP_FUNC_IMPORT eap_am_semaphore_reference_c();
   114 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H eap_am_semaphore_reference_c();
    94 
   115 
    95 	EAP_FUNC_IMPORT void add_reference();
   116 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H void add_reference();
    96 
   117 
    97 	EAP_FUNC_IMPORT void remove_reference();
   118 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H void remove_reference();
    98 
   119 
    99 	EAP_FUNC_IMPORT u32_t get_reference_count();
   120 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H u32_t get_reference_count();
   100 };
   121 };
   101 
   122 
   102 // ---------------------------------------------
   123 // ---------------------------------------------
   103 
   124 
   104 /// This class is base of the semaphore.
   125 /// This class is base of the semaphore.
   105 class EAP_EXPORT eap_am_semaphore_base_c
   126 class EAP_CLASS_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H eap_am_semaphore_base_c
   106 {
   127 {
   107 private:
   128 private:
   108 
   129 
   109 	eap_am_semaphore_reference_c * m_reference;
   130 	eap_am_semaphore_reference_c * m_reference;
   110 
   131 
   111 	bool m_is_valid;
   132 	bool m_is_valid;
   112 
   133 
   113 public:
   134 public:
   114 
   135 
   115 	EAP_FUNC_IMPORT virtual ~eap_am_semaphore_base_c();
   136 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H virtual ~eap_am_semaphore_base_c();
   116 
   137 
   117 	EAP_FUNC_IMPORT eap_am_semaphore_base_c();
   138 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H eap_am_semaphore_base_c();
   118 
   139 
   119 	EAP_FUNC_IMPORT eap_am_semaphore_base_c(const eap_am_semaphore_base_c * const owner);
   140 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H eap_am_semaphore_base_c(const eap_am_semaphore_base_c * const owner);
   120 
   141 
   121 	EAP_FUNC_IMPORT eap_am_semaphore_reference_c * get_reference() const;
   142 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H eap_am_semaphore_reference_c * get_reference() const;
   122 
   143 
   123 	// - - - - - - - - - - - - - - - - - - - - - - - -
   144 	// - - - - - - - - - - - - - - - - - - - - - - - -
   124 
   145 
   125 	/// Returns the validity of the semaphore.
   146 	/// Returns the validity of the semaphore.
   126 	EAP_FUNC_IMPORT bool get_is_valid() const;
   147 	EAP_FUNC_VISIBILITY_ABS_EAP_AM_SEMAPHORE_H bool get_is_valid() const;
   127 
   148 
   128 	// - - - - - - - - - - - - - - - - - - - - - - - -
   149 	// - - - - - - - - - - - - - - - - - - - - - - - -
   129 
   150 
   130 };
   151 };
   131 
   152