Align shared_mem and initial jikes buffer

This commit is contained in:
Thomas Preud'homme 2009-06-25 14:01:18 +02:00 committed by Thomas Preud'homme
parent c9323cd901
commit 6b9777cb9b
3 changed files with 3 additions and 6 deletions

View File

@ -38,8 +38,7 @@ int init_thread_comm(struct thread_comm *comm)
{
void **new_buffer;
new_buffer = (void **) malloc(BUFFER_SIZE);
if (new_buffer == NULL)
if (posix_memalign((void *) &new_buffer, CACHE_LINE_SIZE, BUFFER_SIZE))
{
fprintf(stderr, "Failed to allocate a new buffer for the thread\n");
return -1;

View File

@ -15,8 +15,7 @@ __thread volatile int prod_idx = 0;
int init_thread_comm(struct thread_comm *comm)
{
shared_space = (volatile void **) malloc(SHARED_SPACE_SIZE);
if (shared_space == NULL)
if (posix_memalign((void *) &shared_space, CACHE_LINE_SIZE, SHARED_SPACE_SIZE))
{
fprintf(stderr, "Unable to allocate space for shared mem communication\n");
return -1;

View File

@ -15,8 +15,7 @@ __thread volatile int prod_idx = 0;
int init_thread_comm(struct thread_comm *comm)
{
shared_space = (volatile void **) malloc(SHARED_SPACE_SIZE);
if (shared_space == NULL)
if (posix_memalign((void *) &shared_space, CACHE_LINE_SIZE, SHARED_SPACE_SIZE))
{
fprintf(stderr, "Unable to allocate space for shared mem communication\n");
return -1;