Use common code for atomic_add().
This commit is contained in:
@ -31,6 +31,7 @@
|
||||
#include <skygw_types.h>
|
||||
#include <skygw_utils.h>
|
||||
#include <log_manager.h>
|
||||
#include "atomic.h"
|
||||
|
||||
#define MAX_PREFIXLEN 250
|
||||
#define MAX_SUFFIXLEN 250
|
||||
@ -301,6 +302,8 @@ static int find_last_seqno(strpart_t* parts, int seqno, int seqnoidx);
|
||||
void flushall_logfiles(bool flush);
|
||||
bool thr_flushall_check();
|
||||
|
||||
#include "../core/atomic.c"
|
||||
|
||||
const char* get_suffix_default(void)
|
||||
{
|
||||
return ".log";
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <skygw_types.h>
|
||||
#include <sys/time.h>
|
||||
#include "skygw_utils.h"
|
||||
#include "atomic.h"
|
||||
|
||||
#if defined(MLIST)
|
||||
|
||||
@ -71,23 +72,6 @@ static void mlist_free_memory(mlist_t* ml, char* name);
|
||||
static void thread_free_memory(skygw_thread_t* th, char* name);
|
||||
/** End of static function declarations */
|
||||
|
||||
int atomic_add(
|
||||
int *variable,
|
||||
int value)
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
return (int) __sync_fetch_and_add (variable, value);
|
||||
#else
|
||||
asm volatile(
|
||||
"lock; xaddl %%eax, %2;"
|
||||
:"=a" (value)
|
||||
: "a" (value), "m" (*variable)
|
||||
: "memory" );
|
||||
return value;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/** mutexed list, mlist */
|
||||
|
||||
#if defined(MLIST)
|
||||
|
@ -263,8 +263,6 @@ int skygw_rwlock_rdlock(skygw_rwlock_t* rwlock);
|
||||
int skygw_rwlock_unlock(skygw_rwlock_t* rwlock);
|
||||
int skygw_rwlock_init(skygw_rwlock_t** rwlock);
|
||||
|
||||
int atomic_add(int *variable, int value);
|
||||
|
||||
EXTERN_C_BLOCK_BEGIN
|
||||
|
||||
size_t get_decimal_len(size_t s);
|
||||
|
Reference in New Issue
Block a user