stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farid Zaripov" <Farid_Zari...@epam.com>
Subject [PATCH] std::messages thread safety
Date Fri, 14 Sep 2007 17:16:06 GMT
  The 22.locale.messages.cpp test fails due to using incorrect
guard type in functions from messages.cpp file. There used
_RWSTD_MT_STATIC_GUARD(), so that the functions are protected
from working simultaneously with itself only. But from every that
functions invoked __rw_manage_cat_data() which working with
shared global repository of open catalogs.

  The proposed patch:

  ChangeLog:
  * messages.cpp (__rw_cat_open): Use _RWSTD_MT_CLASS_GUARD instead of
  _RWSTD_MT_STATIC_GUARD to synchronize acces to global repository of
open
  catalogs.
  (__rw_get_message): Ditto.
  (__rw_get_locale): Ditto.
  (__rw_cat_close): Ditto.

Index: messages.cpp
===================================================================
--- messages.cpp	(revision 575597)
+++ messages.cpp	(working copy)
@@ -213,7 +213,7 @@
 int
 __rw_cat_open (const _STD::string &cat_name, const _STD::locale &loc)
 {
-    _RWSTD_MT_STATIC_GUARD (__rw_open_cat_data);
+    _RWSTD_MT_CLASS_GUARD (__rw_open_cat_data);
 
     const nl_catd catd = catopen (cat_name.c_str (), NL_CAT_LOCALE);
     if (_RWSTD_BAD_CATD == catd)
@@ -239,7 +239,7 @@
     if (cat < 0)
         return 0;
 
-    _RWSTD_MT_STATIC_GUARD (__rw_open_cat_data);
+    _RWSTD_MT_CLASS_GUARD (__rw_open_cat_data);
 
     __rw_open_cat_data *const pcat_data = __rw_manage_cat_data (cat,
0);
 
@@ -264,7 +264,7 @@
 const _STD::locale&
 __rw_get_locale (int cat)
 {
-    _RWSTD_MT_STATIC_GUARD (__rw_open_cat_data);
+    _RWSTD_MT_CLASS_GUARD (__rw_open_cat_data);
 
     _RWSTD_ASSERT (0 <= cat);
     __rw_open_cat_data* const pcat_data = __rw_manage_cat_data (cat,
0);
@@ -279,7 +279,7 @@
 void
 __rw_cat_close (int cat)
 {
-    _RWSTD_MT_STATIC_GUARD (__rw_open_cat_data);
+    _RWSTD_MT_CLASS_GUARD (__rw_open_cat_data);
     
     __rw_open_cat_data* const pcat_data =
         cat < 0 ? 0 : __rw_manage_cat_data (cat, 0);

Farid.

Mime
View raw message