Changed log manager API so that pointer reference to logmanager is not used anymore. Every call initializes logmanager now except skygw_logmanager_done and skygw_log_flush.
skygw_logmanager_init is still useful because it allows for providing memory address for log manager where it can store a list of preallocated write buffers. TBD. Logmanager access is now protected with spinlock familiar from epoll/core/spinlock.c . It is modified to avoid trashing; misses are counted and every tenth subsequent lock acquiring attempt triggers short random sleep.
This commit is contained in:
@ -134,10 +134,21 @@ static bool file_write_header(skygw_file_t* file);
|
||||
static void simple_mutex_free_memory(simple_mutex_t* sm);
|
||||
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)
|
||||
{
|
||||
asm volatile(
|
||||
"lock; xaddl %%eax, %2;"
|
||||
:"=a" (value)
|
||||
: "a" (value), "m" (*variable)
|
||||
: "memory" );
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
/** mutexed list, mlist */
|
||||
|
||||
#if defined(MLIST)
|
||||
|
Reference in New Issue
Block a user