Multiple threads may use these. Allow only one at a time.
#include <yaz/zgdu.h>
#include <yaz/retrieval.h>
+#include <boost/thread/mutex.hpp>
+
#if HAVE_USEMARCON
#include <usemarconlib.h>
#include <defines.h>
#if HAVE_USEMARCON
struct info_usemarcon {
+ boost::mutex m_mutex;
+
char *stage1;
char *stage2;
{
struct info_usemarcon *p = (struct info_usemarcon *) info;
+ boost::mutex::scoped_lock lock(p->m_mutex);
+
if (p->usemarcon1)
{
char *converted;
delete p->usemarcon2;
xfree(p->stage1);
xfree(p->stage2);
- xfree(p);
+ delete p;
}
static void *construct_usemarcon(const xmlNode *ptr, const char *path,
if (strcmp((const char *) ptr->name, "usemarcon"))
return 0;
- struct info_usemarcon *p = (struct info_usemarcon *) xmalloc(sizeof(*p));
+ struct info_usemarcon *p = new(struct info_usemarcon);
p->stage1 = 0;
p->stage2 = 0;
p->usemarcon1 = 0;