Commit d47e3074 authored by Cedric Roux's avatar Cedric Roux

rename T_cache to T_local_cache in T/local_tracer.c

needed because of the following commit
parent 6a809e84
......@@ -14,7 +14,7 @@
#include "T_defs.h"
#include "T_IDs.h"
static T_cache_t *T_cache;
static T_cache_t *T_local_cache;
static int T_busylist_head;
typedef struct databuf {
......@@ -287,7 +287,7 @@ static void forward(void *_forwarder, char *buf, int size)
static void wait_message(void)
{
while (T_cache[T_busylist_head].busy == 0) usleep(1000);
while (T_local_cache[T_busylist_head].busy == 0) usleep(1000);
}
static void init_shm(void)
......@@ -297,17 +297,17 @@ static void init_shm(void)
if (s == -1) { perror(T_SHM_FILENAME); abort(); }
if (ftruncate(s, T_CACHE_SIZE * sizeof(T_cache_t)))
{ perror(T_SHM_FILENAME); abort(); }
T_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
PROT_READ | PROT_WRITE, MAP_SHARED, s, 0);
if (T_cache == NULL)
T_local_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
PROT_READ | PROT_WRITE, MAP_SHARED, s, 0);
if (T_local_cache == NULL)
{ perror(T_SHM_FILENAME); abort(); }
close(s);
/* let's garbage the memory to catch some potential problems
* (think multiprocessor sync issues, barriers, etc.)
*/
memset(T_cache, 0x55, T_CACHE_SIZE * sizeof(T_cache_t));
for (i = 0; i < T_CACHE_SIZE; i++) T_cache[i].busy = 0;
memset(T_local_cache, 0x55, T_CACHE_SIZE * sizeof(T_cache_t));
for (i = 0; i < T_CACHE_SIZE; i++) T_local_cache[i].busy = 0;
}
void T_local_tracer_main(int remote_port, int wait_for_tracer,
......@@ -335,9 +335,9 @@ void T_local_tracer_main(int remote_port, int wait_for_tracer,
while (1) {
wait_message();
__sync_synchronize();
forward(f, T_cache[T_busylist_head].buffer,
T_cache[T_busylist_head].length);
T_cache[T_busylist_head].busy = 0;
forward(f, T_local_cache[T_busylist_head].buffer,
T_local_cache[T_busylist_head].length);
T_local_cache[T_busylist_head].busy = 0;
T_busylist_head++;
T_busylist_head &= T_CACHE_SIZE - 1;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment