#include "mm/memory.h"
-#include "threads/lock-common.h"
+#include "threads/mutex.hpp"
#include "toolbox/list.h"
l = NEW(list_t);
- LOCK_INIT_OBJECT_LOCK(l);
-
+ l->mutex = Mutex_new();
l->first = NULL;
l->last = NULL;
l->nodeoffset = nodeoffset;
{
assert(l != NULL);
+ Mutex_delete(l->mutex);
+
FREE(l, list_t);
}
l = DNEW(list_t);
+ l->mutex = NULL;
l->first = NULL;
l->last = NULL;
l->nodeoffset = nodeoffset;
void list_lock(list_t *l)
{
- LOCK_MONITOR_ENTER(l);
+ Mutex_lock(l->mutex);
}
void list_unlock(list_t *l)
{
- LOCK_MONITOR_EXIT(l);
+ Mutex_unlock(l->mutex);
}
#include "config.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <stdint.h>
#include "vm/global.h"
+#include "threads/mutex.hpp"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
/* ---------------------- interface description -----------------------------
typedef struct list_t list_t;
struct list_t {
-#if defined(ENABLE_THREADS)
- java_object_t lock; /* threads lock object */
-#endif
+ Mutex* mutex; /* threads lock object */
listnode_t *first;
listnode_t *last;
int nodeoffset;
#include "native/native.h"
-#include "threads/lock-common.h"
-
#include "toolbox/list.h"
#include "toolbox/logging.h" /* XXX remove me! */
/* enter a monitor on the patcher list */
- LOCK_MONITOR_ENTER(code->patchers);
+ list_lock(code->patchers);
/* search the patcher information for the given PC */
log_println("patcher_handler: double-patching detected!");
}
#endif
- LOCK_MONITOR_EXIT(code->patchers);
+ list_unlock(code->patchers);
return NULL;
}
if (result == false) {
e = exceptions_get_and_clear_exception();
- LOCK_MONITOR_EXIT(code->patchers);
+ list_unlock(code->patchers);
return e;
}
pr->done = true; /* XXX this is only preliminary to prevent double-patching */
- LOCK_MONITOR_EXIT(code->patchers);
+ list_unlock(code->patchers);
return NULL;
}