Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ endif()
# harder. Nonetheless, it can still be added by passing CMAKE_USER_C_FLAGS
# Also note that define the C99 as the minimum supported standard so the code can be compiled with older GCC versions
# (circa 4.4)
set(CMAKE_C_FLAGS_DEBUG "-Wall -std=c99 -z execstack -fdump-tree-all -Wall -pg -g ${CMAKE_USER_C_FLAGS}")
set(CMAKE_C_FLAGS "-O3 -std=c99 -Wall ${CMAKE_USER_C_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "-Wall -std=gnu11 -z execstack -fdump-tree-all -Wall -pg -g ${CMAKE_USER_C_FLAGS}")
set(CMAKE_C_FLAGS "-O3 -std=gnu11 -Wall ${CMAKE_USER_C_FLAGS}")


set(ARTEMIS_LIB_NAME artemis-native-64)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,11 @@
#include <fcntl.h>
#include <stdlib.h>
#include <pthread.h>
#include <stdatomic.h>
#include <limits.h>
#include "org_apache_activemq_artemis_nativo_jlibaio_LibaioContext.h"
#include "exception_helper.h"

//x86 has a strong memory model and there is no need of HW fences if just Write-Back (WB) memory is used
#define mem_barrier() __asm__ __volatile__ ("":::"memory")
#define read_barrier() __asm__ __volatile__("":::"memory")
#define store_barrier() __asm__ __volatile__("":::"memory")

struct io_control {
io_context_t ioContext;
struct io_event * events;
Expand Down Expand Up @@ -135,7 +131,7 @@ static int ringio_get_events(io_context_t aio_ctx, long min_nr, long max,
const unsigned ring_nr = ring->nr;
// We're assuming to be the exclusive writer to head, so we just need a compiler barrier
unsigned head = ring->head;
mem_barrier();
atomic_thread_fence(memory_order_acquire);
const unsigned tail = ring->tail;
int available = tail - head;
if (available < 0) {
Expand Down Expand Up @@ -169,7 +165,7 @@ static int ringio_get_events(io_context_t aio_ctx, long min_nr, long max,

//the kernel has written ring->tail from an interrupt:
//we need to load acquire the completed events here
read_barrier();
atomic_thread_fence(memory_order_acquire);
const int available_nr = available < max? available : max;
//if isn't needed to wrap we can avoid % operations that are quite expansive
const int needMod = ((head + available_nr) >= ring_nr) ? 1 : 0;
Expand All @@ -183,7 +179,7 @@ static int ringio_get_events(io_context_t aio_ctx, long min_nr, long max,
}
//it allow the kernel to build its own view of the ring buffer size
//and push new events if there are any
store_barrier();
atomic_thread_fence(memory_order_release);
ring->head = head;
#ifdef DEBUG
fprintf(stdout, "consumed non sys-call = %d\n", available_nr);
Expand Down
2 changes: 1 addition & 1 deletion src/main/docker/Dockerfile-centos
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# ActiveMQ Artemis

FROM centos:7 as builder-env
FROM centos:stream8 as builder-env

LABEL maintainer="Apache ActiveMQ Team"

Expand Down