summaryrefslogtreecommitdiff
path: root/ace/OS.h
diff options
context:
space:
mode:
Diffstat (limited to 'ace/OS.h')
-rw-r--r--ace/OS.h229
1 files changed, 44 insertions, 185 deletions
diff --git a/ace/OS.h b/ace/OS.h
index 3205068f367..80db65108ef 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -1062,6 +1062,10 @@ ACE_OS_Export ACE_Time_Value operator + (const ACE_Time_Value &tv1,
ACE_OS_Export ACE_Time_Value operator - (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2);
+// This forward declaration is needed by the set() and FILETIME() functions
+#if defined (ghs)
+ class ACE_Export ACE_U_LongLong;
+#endif //ghs
// -------------------------------------------------------------------
/**
@@ -1216,7 +1220,11 @@ public:
# if defined (ACE_WIN32)
/// Const time difference between FILETIME and POSIX time.
+# if defined (ghs)
+ static const ACE_U_LongLong FILETIME_to_timval_skew;
+# else
static const DWORDLONG FILETIME_to_timval_skew;
+# endif // ghs
# endif /* ACE_WIN32 */
private:
@@ -1490,209 +1498,55 @@ private: ACE_Time_Value *max_wait_time_;
# undef ctime
# endif /* ACE_HAS_BROKEN_CTIME */
-/// Service Objects, i.e., objects dynamically loaded via the service
-/// configurator, must provide a destructor function with the
-/// following prototype to perform object cleanup.
extern "C" {
typedef void (*ACE_Service_Object_Exterminator)(void *);
}
-/** @name Service Configurator macros
- *
- * The following macros are used to define helper objects used in
- * ACE's Service Configurator. This is an implementation of the
- * Service Configurator pattern:
- *
- * http://www.cs.wustl.edu/~schmidt/PDF/SvcConf.pdf
- *
- * The intent of this pattern is to allow developers to dynamically
- * load and configure services into a system. With a little help from
- * this macros statically linked services can also be dynamically
- * configured.
- *
- * More details about this component are available in the documentation
- * of the ACE_Service_Configurator class and also
- * ACE_Dynamic_Service.
- *
- * Notice that in all the macros the SERVICE_CLASS parameter must be
- * the name of a class derived from ACE_Service_Object.
- */
-//@{
-/// Declare a the data structure required to register a statically
-/// linked service into the service configurator.
-/**
- * The macro should be used in the header file where the service is
- * declared, its only argument is usually the name of the class that
- * implements the service.
- *
- * @param SERVICE_CLASS The name of the class implementing the
- * service.
- */
-# define ACE_STATIC_SVC_DECLARE(SERVICE_CLASS) \
-extern ACE_Static_Svc_Descriptor ace_svc_desc_##SERVICE_CLASS ;
-
-/// As ACE_STATIC_SVC_DECLARE, but using an export macro for NT
-/// compilers.
-/**
- * NT compilers require the use of explicit directives to export and
- * import symbols from a DLL. If you need to define a service in a
- * dynamic library you should use this version instead.
- * Normally ACE uses a macro to inject the correct export/import
- * directives on NT. Naturally it also the macro expands to a blank
- * on platforms that do not require such directives.
- * The first argument (EXPORT_NAME) is the prefix for this export
- * macro, the full name is formed by appending _Export.
- * ACE provides tools to generate header files that define the macro
- * correctly on all platforms, please see
- * $ACE_ROOT/bin/generate_export_file.pl
- *
- * @param EXPORT_NAME The export macro name prefix.
- * @param SERVICE_CLASS The name of the class implementing the service.
- */
-#define ACE_STATIC_SVC_DECLARE_EXPORT(EXPORT_NAME,SERVICE_CLASS) \
-extern EXPORT_NAME##_Export ACE_Static_Svc_Descriptor ace_svc_desc_##SERVICE_CLASS;
+// Static service macros
+# define ACE_STATIC_SVC_DECLARE(X) \
+extern ACE_Static_Svc_Descriptor ace_svc_desc_##X ;
+#define ACE_STATIC_SVC_DECLARE_EXPORT(CLS,X) \
+extern CLS##_Export ACE_Static_Svc_Descriptor ace_svc_desc_##X;
+# define ACE_STATIC_SVC_DEFINE(X, NAME, TYPE, FN, FLAGS, ACTIVE) \
+ACE_Static_Svc_Descriptor ace_svc_desc_##X = { NAME, TYPE, FN, FLAGS, ACTIVE };
-/// Define the data structure used to register a statically linked
-/// service into the Service Configurator.
-/**
- * The service configurator requires several arguments to build and
- * control an statically linked service, including its name, the
- * factory function used to construct the service, and some flags.
- * All those parameters are configured in a single structure, an
- * instance of this structure is statically initialized using the
- * following macro.
- *
- * @param SERVICE_CLASS The name of the class that implements the
- * service, must derive from ACE_Service_Configurator.
- * @param NAME The name for this service, this name is used by the
- * service configurator to match configuration options provided in
- * the svc.conf file.
- * @param TYPE The type of object. Objects can be streams or service
- * objects. Please read the ACE_Service_Configurator and ASX
- * documentation for more details.
- * @param FN The name of the factory function, usually the
- * ACE_SVC_NAME macro can be used to generate the name. The
- * factory function is often defined using ACE_FACTORY_DECLARE and
- * ACE_FACTORY_DEFINE.
- * @param FLAGS Flags to control the ownership and lifecycle of the
- * object. Please read the ACE_Service_Configurator documentation
- * for more details.
- * @param ACTIVE If not zero then a thread will be dedicate to the
- * service. Please read the ACE_Service_Configurator documentation
- * for more details.
- */
-#define ACE_STATIC_SVC_DEFINE(SERVICE_CLASS, NAME, TYPE, FN, FLAGS, ACTIVE) \
-ACE_Static_Svc_Descriptor ace_svc_desc_##SERVICE_CLASS = { NAME, TYPE, FN, FLAGS, ACTIVE };
-
-/// Automatically register a service with the service configurator
-/**
- * In some applications the services must be automatically registered
- * with the service configurator, before main() starts.
- * The ACE_STATIC_SVC_REQUIRE macro defines a class whose constructor
- * register the service, it also defines a static instance of that
- * class to ensure that the service is registered before main.
- *
- * On platforms that lack adequate support for static C++ objects the
- * macro ACE_STATIC_SVC_REGISTER can be used to explicitly register
- * the service.
- *
- * @todo One class per-Service_Object seems wasteful. It should be
- * possible to define a single class and re-use it for all the
- * service objects, just by passing the Service_Descriptor as an
- * argument to the constructor.
- */
#if defined(ACE_LACKS_STATIC_CONSTRUCTORS)
-# define ACE_STATIC_SVC_REQUIRE(SERVICE_CLASS)\
-class ACE_Static_Svc_##SERVICE_CLASS {\
+# define ACE_STATIC_SVC_REQUIRE(X)\
+class ACE_Static_Svc_##X {\
public:\
- ACE_Static_Svc_##SERVICE_CLASS() { \
- ACE_Service_Config::static_svcs ()->insert (\
- &ace_svc_desc_##SERVICE_CLASS); \
- } \
+ ACE_Static_Svc_##X() { ACE_Service_Config::static_svcs ()->insert (&ace_svc_desc_##X); }\
};
-#define ACE_STATIC_SVC_REGISTER(SERVICE_CLASS)\
-ACE_Static_Svc_##SERVICE_CLASS ace_static_svc_##SERVICE_CLASS
+#define ACE_STATIC_SVC_REGISTER(X)\
+ACE_Static_Svc_##X ace_static_svc_##X
#else /* !ACE_LACKS_STATIC_CONSTRUCTORS */
-# define ACE_STATIC_SVC_REQUIRE(SERVICE_CLASS)\
-class ACE_Static_Svc_##SERVICE_CLASS {\
+# define ACE_STATIC_SVC_REQUIRE(X)\
+class ACE_Static_Svc_##X {\
public:\
- ACE_Static_Svc_##SERVICE_CLASS() { \
- ACE_Service_Config::static_svcs ()->insert (\
- &ace_svc_desc_##SERVICE_CLASS); \
- } \
+ ACE_Static_Svc_##X() { ACE_Service_Config::static_svcs ()->insert (&ace_svc_desc_##X); }\
};\
-static ACE_Static_Svc_##SERVICE_CLASS ace_static_svc_##SERVICE_CLASS;
-#define ACE_STATIC_SVC_REGISTER(SERVICE_CLASS) do {} while (0)
+static ACE_Static_Svc_##X ace_static_svc_##X;
+#define ACE_STATIC_SVC_REGISTER(X) do {} while (0)
#endif /* !ACE_LACKS_STATIC_CONSTRUCTORS */
-/// Declare the factory method used to create dynamically loadable
-/// services.
-/**
- * Once the service implementation is dynamically loaded the Service
- * Configurator uses a factory method to create the object.
- * This macro declares such a factory function with the proper
- * interface and export macros.
- * Normally used in the header file that declares the service
- * implementation.
- *
- * @param CLS must match the prefix of the export macro used for this
- * service.
- * @param SERVICE_CLASS must match the name of the class that
- * implements the service.
- *
- */
-#define ACE_FACTORY_DECLARE(CLS,SERVICE_CLASS) \
-extern "C" CLS##_Export ACE_Service_Object *\
-_make_##SERVICE_CLASS (ACE_Service_Object_Exterminator *);
-
-/// Define the factory method (and destructor) for a dynamically
-/// loadable service.
-/**
- * Use with arguments matching ACE_FACTORY_DECLARE.
- * Normally used in the .cpp file that defines the service
- * implementation.
- *
- * This macro defines both the factory method and the function used to
- * cleanup the service object.
- */
-# define ACE_FACTORY_DEFINE(CLS,SERVICE_CLASS) \
-extern "C" void _gobble_##SERVICE_CLASS (void *p) { \
+// More generic dynamic/static service macros.
+# define ACE_FACTORY_DECLARE(CLS,X) extern "C" CLS##_Export ACE_Service_Object *_make_##X (ACE_Service_Object_Exterminator *);
+# define ACE_FACTORY_DEFINE(CLS,X) \
+extern "C" void _gobble_##X (void *p) { \
ACE_Service_Object *_p = ACE_reinterpret_cast (ACE_Service_Object *, p); \
ACE_ASSERT (_p != 0); \
delete _p; } \
-extern "C" ACE_Service_Object *\
-_make_##SERVICE_CLASS (ACE_Service_Object_Exterminator *gobbler) \
-{ \
- ACE_TRACE (#SERVICE_CLASS); \
- if (gobbler != 0) \
- *gobbler = (ACE_Service_Object_Exterminator) _gobble_##SERVICE_CLASS; \
- return new SERVICE_CLASS; \
-}
+extern "C" ACE_Service_Object *_make_##X (ACE_Service_Object_Exterminator *gobbler) \
+{ ACE_TRACE (#X); \
+if (gobbler != 0) *gobbler = (ACE_Service_Object_Exterminator) _gobble_##X; return new X; }
-/// The canonical name for a service factory method
-#define ACE_SVC_NAME(SERVICE_CLASS) _make_##SERVICE_CLASS
-
-/// The canonical way to invoke (i.e. construct) a service factory
-/// method.
-#define ACE_SVC_INVOKE(SERVICE_CLASS) _make_##SERVICE_CLASS (0)
-
-//@}
-
-/** @name Helper macros for services defined in the netsvcs library.
- *
- * The ACE services defined in netsvcs use this helper macros for
- * simplicity.
- *
- * @todo The macros should be moved into the netsvcs library, they
- * have no place in ace/OS.h
- */
-//@{
+// Dynamic/static service macros.
# define ACE_SVC_FACTORY_DECLARE(X) ACE_FACTORY_DECLARE (ACE_Svc, X)
+# define ACE_SVC_INVOKE(X) _make_##X (0)
+# define ACE_SVC_NAME(X) _make_##X
# define ACE_SVC_FACTORY_DEFINE(X) ACE_FACTORY_DEFINE (ACE_Svc, X)
-//@}
# if defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))
# define ACE_TSS_TYPE(T) ACE_TSS< T >
@@ -1900,7 +1754,7 @@ struct stat
#else
# if defined (ACE_HAS_EXCEPTIONS)
# define ACE_THROW_SPEC(X) throw X
-# if defined (ACE_WIN32)
+# if defined (ACE_WIN32) && !defined (ghs)
// @@ MSVC "supports" the keyword but doesn't implement it (Huh?).
// Therefore, we simply supress the warning for now.
# pragma warning( disable : 4290 )
@@ -2905,8 +2759,8 @@ typedef unsigned int size_t;
typedef off64_t ACE_LOFF_T;
# elif defined (__sun)
typedef offset_t ACE_LOFF_T;
-# elif defined (WIN32) //Add by Nick Lin -- for win32 llseek
- typedef __int64 ACE_LOFF_T; //Add by Nick Lin -- for win32 llseek
+# elif defined (WIN32) //Add by Nick Lin -- for win32 llseek
+ typedef __int64 ACE_LOFF_T; //Add by Nick Lin -- for win32 llseek
# else
typedef loff_t ACE_LOFF_T;
# endif
@@ -3101,7 +2955,7 @@ typedef void (*ACE_SignalHandlerV)(...);
// Turn off warnings for /W4
// To resume any of these warning: #pragma warning(default: 4xxx)
// which should be placed after these defines
-# ifndef ALL_WARNINGS
+# if !defined (ALL_WARNINGS) && !defined(ghs)
// #pragma warning(disable: 4101) // unreferenced local variable
# pragma warning(disable: 4127) /* constant expression for TRACE/ASSERT */
# pragma warning(disable: 4134) /* message map member fxn casts */
@@ -3342,12 +3196,17 @@ typedef HANDLE ACE_hthread_t;
typedef DWORD ACE_thread_key_t;
# endif /* ! ACE_HAS_TSS_EMULATION */
+# if !defined (ghs)
// 64-bit quad-word definitions.
typedef unsigned __int64 ACE_QWORD;
typedef unsigned __int64 ACE_hrtime_t;
inline ACE_QWORD ACE_MAKE_QWORD (DWORD lo, DWORD hi) { return ACE_QWORD (lo) | (ACE_QWORD (hi) << 32); }
inline DWORD ACE_LOW_DWORD (ACE_QWORD q) { return (DWORD) q; }
inline DWORD ACE_HIGH_DWORD (ACE_QWORD q) { return (DWORD) (q >> 32); }
+# else
+// Can't find ANY place that ACE_QWORD is used, but hrtime_t is.
+typedef ACE_UINT64 ACE_hrtime_t;
+# endif
// Win32 dummies to help compilation.