(list_free): Delete the mutex.
(list_lock, list_unlock): Use Mutex functions.
* src/toolbox/list.h (list_t): Use Mutex instead of java_object_t.
* src/vm/jit/patcher-common.c (patcher_handler): Use
list_lock/list_unlock.
-#include "threads/lock-common.h"
+#include "threads/mutex.hpp"
#include "toolbox/list.h"
#include "toolbox/list.h"
- LOCK_INIT_OBJECT_LOCK(l);
-
+ l->mutex = Mutex_new();
l->first = NULL;
l->last = NULL;
l->nodeoffset = nodeoffset;
l->first = NULL;
l->last = NULL;
l->nodeoffset = nodeoffset;
+ Mutex_delete(l->mutex);
+
l->first = NULL;
l->last = NULL;
l->nodeoffset = nodeoffset;
l->first = NULL;
l->last = NULL;
l->nodeoffset = nodeoffset;
void list_lock(list_t *l)
{
void list_lock(list_t *l)
{
void list_unlock(list_t *l)
{
void list_unlock(list_t *l)
{
+ Mutex_unlock(l->mutex);
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <stdint.h>
#include "vm/global.h"
#include <stdint.h>
#include "vm/global.h"
+#include "threads/mutex.hpp"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
/* ---------------------- interface description -----------------------------
/* ---------------------- interface description -----------------------------
typedef struct list_t list_t;
struct list_t {
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;
listnode_t *first;
listnode_t *last;
int nodeoffset;
#include "native/native.h"
#include "native/native.h"
-#include "threads/lock-common.h"
-
#include "toolbox/list.h"
#include "toolbox/logging.h" /* XXX remove me! */
#include "toolbox/list.h"
#include "toolbox/logging.h" /* XXX remove me! */
/* enter a monitor on the patcher list */
/* enter a monitor on the patcher list */
- LOCK_MONITOR_ENTER(code->patchers);
+ list_lock(code->patchers);
/* search the patcher information for the given PC */
/* search the patcher information for the given PC */
log_println("patcher_handler: double-patching detected!");
}
#endif
log_println("patcher_handler: double-patching detected!");
}
#endif
- LOCK_MONITOR_EXIT(code->patchers);
+ list_unlock(code->patchers);
if (result == false) {
e = exceptions_get_and_clear_exception();
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 */
return e;
}
pr->done = true; /* XXX this is only preliminary to prevent double-patching */
- LOCK_MONITOR_EXIT(code->patchers);
+ list_unlock(code->patchers);