summaryrefslogtreecommitdiff
path: root/ace/OS_Errno.h
diff options
context:
space:
mode:
Diffstat (limited to 'ace/OS_Errno.h')
-rw-r--r--ace/OS_Errno.h37
1 files changed, 36 insertions, 1 deletions
diff --git a/ace/OS_Errno.h b/ace/OS_Errno.h
index 7318147ae37..5ab0d2f2492 100644
--- a/ace/OS_Errno.h
+++ b/ace/OS_Errno.h
@@ -20,7 +20,42 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "ace/OS_NS_errno.h"
+#include "ace/os_include/os_errno.h"
+
+#if defined (ACE_HAS_WINCE_BROKEN_ERRNO)
+/**
+ * @class ACE_CE_Errno
+ *
+ * Some versions of CE don't support <errno> and some versions'
+ * implementations are busted. So we implement our own.
+ * Our implementation takes up one Tls key, however, it does not
+ * allocate memory fromt the heap so there's no problem with cleanin
+ * up the errno when a thread exit.
+ */
+class ACE_Export ACE_CE_Errno
+{
+public:
+ ACE_CE_Errno () {}
+ static void init ();
+ static void fini ();
+ static ACE_CE_Errno *instance ();
+
+ operator int (void) const;
+ int operator= (int);
+
+private:
+ static ACE_CE_Errno *instance_;
+ static DWORD errno_key_;
+};
+
+# define errno (* (ACE_CE_Errno::instance ()))
+#endif /* ACE_HAS_WINCE_BROKEN_ERRNO */
+
+#if defined (ACE_HAS_WINCE_BROKEN_ERRNO)
+# define ACE_ERRNO_TYPE ACE_CE_Errno
+#else
+# define ACE_ERRNO_TYPE int
+#endif /* ACE_HAS_WINCE */
/**
* @class ACE_Errno_Guard