00000004 b loaded_handles_size
00000008 b n_loaded_handles
+ OK. Now serialized, except the reload_cleanup, which
+ presumably is done during a gc-wait (during Prim_band_load),
+ and during OS_reset (which is called where?).
+
pruxffi.o:
00000004 b c_call_continue
00000000 B cstack_depth
/* This file contains the interface to the unix dynamic loader. */
-#include "scheme.h"
#include "prims.h"
#include "usrdef.h"
#include "syscall.h"
static void * dld_lookup (void *, const char *);
#define ARG_HANDLE(n) ((void *) (arg_ulong_integer (n)))
+
+#ifdef ENABLE_SMP
+static pthread_mutex_t mutex = MUTEX_INITIALIZER;
+# ifdef ENABLE_DEBUGGING_TOOLS
+static bool locked_p = false;
+# endif
+#endif
\f
DEFINE_PRIMITIVE ("DLD-LOAD-FILE", Prim_dld_load_file, 2, 2,
"(FILENAME WEAK-PAIR)\n\
{
void * handle;
+ LOCK();
if (!cleanup_registered_p)
{
add_reload_cleanup (dld_unload_all);
}
}
(loaded_handles[n_loaded_handles++]) = handle;
+ UNLOCK();
return (handle);
}
static void
dld_unload (void * handle)
{
+ LOCK();
dld_finalize (handle);
if ((dlclose (handle)) != 0)
{
+ UNLOCK();
SCHEME_OBJECT v = (allocate_marked_vector (TC_VECTOR, 3, 1));
VECTOR_SET (v, 0, (LONG_TO_UNSIGNED_FIXNUM (ERR_IN_SYSTEM_CALL)));
VECTOR_SET (v, 1, (char_pointer_to_string ("dlclose")));
break;
}
}
+ UNLOCK();
}
static void
void * address;
const char * error_string;
+ LOCK();
dlerror (); /* discard any outstanding errors */
address = (dlsym (handle, symbol));
error_string = (dlerror ());
+ UNLOCK();
if (error_string != 0)
{
SCHEME_OBJECT v = (allocate_marked_vector (TC_VECTOR, 3, 1));