summaryrefslogtreecommitdiff
path: root/libltdl/lt_error.c
diff options
context:
space:
mode:
authorGary V. Vaughan <gary@gnu.org>2004-04-22 22:08:19 +0000
committerGary V. Vaughan <gary@gnu.org>2004-04-22 22:08:19 +0000
commit14ae34906f05d58a35fe528fb1d65abdd15c28c1 (patch)
tree78fe192b26df0e9a643deb60c2bfc9b23db4f961 /libltdl/lt_error.c
parent4acb7905fab52bee7b8b350f9d08153cdef8ffcd (diff)
downloadlibtool-14ae34906f05d58a35fe528fb1d65abdd15c28c1.tar.gz
According to Howard Chu <hyc@highlandsun.com>:
Applications should assume that the native dlopen is NOT thread-safe, and take care of locking themselves. All application calls into libltdl should thus be protected by the caller. * libltdl/lt_mutex.c, libltdl/lt_mutex.h: Removed. * libltdl/Makefile.am (pkginclude_HEADERS): Removed lt_mutex.h. (libltdl_la_SOURCES): Removed lt_mutex.c and lt_mutex.h. * libltdl/ltdl.h: Don't include lt_mutex.h. * libltdl/lt__private.h (LT__MUTEX_GETERROR, LT__MUTEX_SETERROR) (LT__MUTEX_SETERRORSTR): Renamed to... (LT__GETERROR, LT__SETERROR, LT__SETERRORSTR): ...this. Changed all callers. (LT__MUTEX_LOCK, LT__MUTEX_UNLOCK, lt_dlmutex_lock) (lt_dlmutex_unlock, lt_dlmutex_seterror, lt_dlmutex_geterror): Removed. Changed all callers. * doc/libtool.texi (Thread Saftey in libltdl): * NEWS: Updated.
Diffstat (limited to 'libltdl/lt_error.c')
-rw-r--r--libltdl/lt_error.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/libltdl/lt_error.c b/libltdl/lt_error.c
index 599e4144..01a8d60f 100644
--- a/libltdl/lt_error.c
+++ b/libltdl/lt_error.c
@@ -27,9 +27,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
*/
#include "lt_error.h"
-#include "lt_mutex.h"
#include "lt__private.h"
+LT_GLOBAL_DATA const char *lt__last_error = 0;
+
static const char **user_error_strings = 0;
static int errorcount = LT_ERROR_MAX;
@@ -42,8 +43,6 @@ lt_dladderror (const char *diagnostic)
assert (diagnostic);
- LT__MUTEX_LOCK ();
-
errindex = errorcount - LT_ERROR_MAX;
temp = REALLOC (const char *, user_error_strings, 1 + errindex);
if (temp)
@@ -53,8 +52,6 @@ lt_dladderror (const char *diagnostic)
result = errorcount++;
}
- LT__MUTEX_UNLOCK ();
-
return result;
}
@@ -63,26 +60,22 @@ lt_dlseterror (int errindex)
{
int errors = 0;
- LT__MUTEX_LOCK ();
-
if (errindex >= errorcount || errindex < 0)
{
/* Ack! Error setting the error message! */
- LT__MUTEX_SETERROR (INVALID_ERRORCODE);
+ LT__SETERROR (INVALID_ERRORCODE);
++errors;
}
else if (errindex < LT_ERROR_MAX)
{
/* No error setting the error message! */
- LT__MUTEX_SETERRORSTR (lt__error_strings[errindex]);
+ LT__SETERRORSTR (lt__error_strings[errindex]);
}
else
{
/* No error setting the error message! */
- LT__MUTEX_SETERRORSTR (user_error_strings[errindex - LT_ERROR_MAX]);
+ LT__SETERRORSTR (user_error_strings[errindex - LT_ERROR_MAX]);
}
- LT__MUTEX_UNLOCK ();
-
return errors;
}