small orp fixes.

This commit is contained in:
Vitor Santos Costa 2010-01-15 12:04:01 +00:00
parent 7da431fe00
commit 44a418bd04
6 changed files with 30 additions and 13 deletions

View File

@ -180,7 +180,7 @@ void Yap_init_local(void) {
LOCAL_top_or_fr = GLOBAL_root_or_fr;
LOCAL_load = 0;
LOCAL_share_request = MAX_WORKERS;
LOCAL_reply_signal = ready;
LOCAL_reply_signal = worker_ready;
#ifdef ENV_COPY
INIT_LOCK(LOCAL_lock_signals);
#endif /* ENV_COPY */

View File

@ -14,7 +14,7 @@
** -------------------------------------- */
#include "Yap.h"
#ifdef YAPOR
#if defined(YAPOR) && !defined(THREADS)
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
@ -77,7 +77,6 @@ close_mapfile(void) {
}
#endif /* MMAP_MEMORY_MAPPING_SCHEME */
void map_memory(long HeapArea, long GlobalLocalArea, long TrailAuxArea, int n_workers) {
void *mmap_addr = (void *)MMAP_ADDR;
#ifdef ACOW
@ -275,4 +274,4 @@ void remap_memory(void) {
}
#endif /* ENV_COPY */
}
#endif /* YAPOR */
#endif /* YAPOR && !THREADS */

View File

@ -129,7 +129,7 @@ struct global_locks {
lockvar bitmap_pruning_workers;
#endif /* TABLING_INNER_CUTS */
lockvar who_locked_heap;
int who_locked_heap;
lockvar heap_access;
lockvar alloc_block;
#if defined(YAPOR_ERRORS) || defined(TABLING_ERRORS)

View File

@ -167,7 +167,7 @@ int get_work(void) {
#ifndef TABLING
/* wait for incomplete installations */
while (LOCAL_reply_signal != ready);
while (LOCAL_reply_signal != worker_ready);
#endif /* TABLING */
if (or_fr_with_work) {

View File

@ -102,7 +102,7 @@ int p_share_work(void) {
REMOTE_p_fase_signal(worker_q) = P_idle;
#ifndef TABLING
/* wait for incomplete installations */
while (LOCAL_reply_signal != ready);
while (LOCAL_reply_signal != worker_ready);
#endif /* TABLING */
LOCAL_reply_signal = sharing;
REMOTE_reply_signal(worker_q) = sharing;
@ -140,8 +140,8 @@ int q_share_work(int worker_p) {
OPTYAP_ERROR_MESSAGE("YOUNGER_CP(B_FZ, LOCAL_top_cp) (q_share_work)");
#endif /* OPTYAP_ERRORS */
#ifdef YAPOR_ERRORS
if (LOCAL_reply_signal != ready)
YAPOR_ERROR_MESSAGE("LOCAL_reply_signal != ready (q_share_work)");
if (LOCAL_reply_signal != worker_ready)
YAPOR_ERROR_MESSAGE("LOCAL_reply_signal != worker_ready (q_share_work)");
#endif /* YAPOR_ERRORS */
/* make sharing request */
@ -156,10 +156,10 @@ int q_share_work(int worker_p) {
UNLOCK_WORKER(worker_p);
/* wait for an answer */
while (LOCAL_reply_signal == ready);
while (LOCAL_reply_signal == worker_ready);
if (LOCAL_reply_signal == no_sharing) {
/* sharing request refused */
LOCAL_reply_signal = ready;
LOCAL_reply_signal = worker_ready;
return FALSE;
}
while (LOCAL_reply_signal == sharing);
@ -168,9 +168,9 @@ int q_share_work(int worker_p) {
/* update registers and return */
#ifndef TABLING
REMOTE_reply_signal(worker_p) = ready;
REMOTE_reply_signal(worker_p) = worker_ready;
#endif /* TABLING */
LOCAL_reply_signal = ready;
LOCAL_reply_signal = worker_ready;
PUT_IN_REQUESTABLE(worker_id);
return TRUE;
}

View File

@ -24,6 +24,24 @@
#define TRY_LOCK(LOCK_PTR) pthread_mutex_trylock(&(LOCK_VAR))
#define LOCK(LOCK_VAR) pthread_mutex_lock(&(LOCK_VAR))
#define UNLOCK(LOCK_VAR) pthread_mutex_unlock(&(LOCK_VAR))
static inline int
xIS_LOCKED(pthread_mutex_t *LOCK_VAR) {
if (pthread_mutex_trylock(LOCK_VAR) == 0) {
pthread_mutex_unlock(LOCK_VAR);
return TRUE;
}
return FALSE;
}
static inline int
xIS_UNLOCKED(pthread_mutex_t *LOCK_VAR) {
if (pthread_mutex_trylock(LOCK_VAR) == 0) {
pthread_mutex_unlock(LOCK_VAR);
return FALSE;
}
return TRUE;
}
#define IS_LOCKED(LOCK_VAR) xIS_LOCKED(&(LOCK_VAR))
#define IS_UNLOCKED(LOCK_VAR) xIS_UNLOCKED(&(LOCK_VAR))
#define INIT_RWLOCK(X) pthread_rwlock_init(&(X), NULL)
#define DESTROY_RWLOCK(X) pthread_rwlock_destroy(&(X))