On 03/26/12 09:13, Elena wrote:
> Hi
>
> Now I’m
> building and testing Firebird-2.5.1.26351 (got from 
> http://www.firebirdsql.org/)
> on HP-UX 11i v3 (HP Integrity server  rx2800 i2 with Intel®  Itanium® 
> processors) using aCC (HP C++ compiler).
>
> I've met the following issue:
>
> Despite aCC
> supports __thread keyword it is set not to use it in src/jrd/common.h, so 
> workaround
> TlsValue class is used. 

If an error, which made people add such lines to common.h, is gone it's
much better to use __thread version of TLS. At least it's faster. I've
asked SAS guys - if they remember how to check that TLS issue, I will
give you directions how to check.

> But when firebird programs are run Firebird::TlsValue
> contextPool is not initialized and this cause the programs to get caught in an
> endless loop (see create_db runtime stack contents below).
>
> I managed
> to build Firebird enabling __thread keyword use and will be testing it.
> Could 
> the issue with TlsValue class be investigated and fixed?

Please try attached patch.
I suppose it will let you have a build with original TLS support on HPUX.

Alex.

PS. We try to collect information about usage of firebird, specially on
not widely used platforms. It it's not hard for you - can you write a
few words about your plans to use firebird?

Index: src/jrd/IntlUtil.cpp
===================================================================
--- src/jrd/IntlUtil.cpp        (revision 54196)
+++ src/jrd/IntlUtil.cpp        (working copy)
@@ -58,6 +58,22 @@
                charset* cs;
                UnicodeUtil::Utf16Collation* collation;
        };
+
+       class Utf8CharSet
+       {
+       public:
+               explicit Utf8CharSet(MemoryPool& pool)
+               {
+                       Firebird::IntlUtil::initUtf8Charset(&obj);
+                       charSet = Jrd::CharSet::createInstance(pool, CS_UTF8, 
&obj);
+               }
+
+       public:
+               charset obj;
+               Firebird::AutoPtr<Jrd::CharSet> charSet;
+       };
+
+       Firebird::InitInstance<Utf8CharSet> utf8CharSet;
 }
 
 
@@ -74,12 +90,9 @@
        ULONG dstLen, UCHAR* dst);
 
 
-GlobalPtr<IntlUtil::Utf8CharSet> IntlUtil::utf8CharSet;
-
-IntlUtil::Utf8CharSet::Utf8CharSet(MemoryPool& pool)
+Jrd::CharSet* IntlUtil::getUtf8CharSet()
 {
-       IntlUtil::initUtf8Charset(&obj);
-       charSet = Jrd::CharSet::createInstance(pool, CS_UTF8, &obj);
+       return utf8CharSet().charSet;
 }
 
 
Index: src/jrd/IntlUtil.h
===================================================================
--- src/jrd/IntlUtil.h  (revision 54196)
+++ src/jrd/IntlUtil.h  (working copy)
@@ -48,10 +48,7 @@
        typedef GenericMap<SpecificAttribute> SpecificAttributesMap;
 
 public:
-       static Jrd::CharSet* getUtf8CharSet()
-       {
-               return utf8CharSet->charSet;
-       }
+       static Jrd::CharSet* getUtf8CharSet();
 
        static string generateSpecificAttributes(Jrd::CharSet* cs, 
SpecificAttributesMap& map);
        static bool parseSpecificAttributes(Jrd::CharSet* cs, ULONG len, const 
UCHAR* s,
@@ -99,19 +96,6 @@
 
        static bool readAttributeChar(Jrd::CharSet* cs, const UCHAR** s, const 
UCHAR* end, ULONG* size,
                bool returnEscape);
-
-private:
-       class Utf8CharSet
-       {
-       public:
-               explicit Utf8CharSet(MemoryPool& pool);
-
-       public:
-               charset obj;
-               AutoPtr<Jrd::CharSet> charSet;
-       };
-
-       static GlobalPtr<Utf8CharSet> utf8CharSet;
 };
 
 }      // namespace Firebird
Index: src/jrd/gds.cpp
===================================================================
--- src/jrd/gds.cpp     (revision 54196)
+++ src/jrd/gds.cpp     (working copy)
@@ -1174,6 +1174,15 @@
  *     Post an event to a log file.
  *
  **************************************/
+#ifdef DEV_BUILD
+       static FB_THREAD_ID loop = 0;
+       if (loop == getThreadId())
+       {
+               abort();
+       }
+       loop = getThreadId();
+#endif
+
        va_list ptr;
        time_t now;
 
@@ -1224,6 +1233,10 @@
 #ifdef WIN_NT
        ReleaseMutex(CleanupTraceHandles::trace_mutex_handle);
 #endif
+
+#ifdef DEV_BUILD
+       loop = 0;
+#endif
 }
 
 void API_ROUTINE gds__print_pool(MemoryPool* pool, const TEXT* text, ...)
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to