mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-10 01:32:16 +00:00
server: move bit set/clear utilities out of red_worker.h
This commit is contained in:
parent
376264b009
commit
fe38ddf724
@ -99,6 +99,7 @@ libspice_server_la_SOURCES = \
|
||||
zlib_encoder.h \
|
||||
spice_bitmap_utils.h \
|
||||
spice_bitmap_utils.c \
|
||||
spice_server_utils.h \
|
||||
$(NULL)
|
||||
|
||||
if SUPPORT_TUNNEL
|
||||
|
||||
@ -39,8 +39,10 @@
|
||||
#endif // USE_OPENGL
|
||||
#include "reds.h"
|
||||
#include "dispatcher.h"
|
||||
#include "red_dispatcher.h"
|
||||
#include "red_parse_qxl.h"
|
||||
#include "spice_server_utils.h"
|
||||
|
||||
#include "red_dispatcher.h"
|
||||
|
||||
static int num_active_workers = 0;
|
||||
|
||||
|
||||
@ -82,6 +82,7 @@
|
||||
#include "migration_protocol.h"
|
||||
#include "spice_timer_queue.h"
|
||||
#include "main_dispatcher.h"
|
||||
#include "spice_server_utils.h"
|
||||
|
||||
//#define COMPRESS_STAT
|
||||
//#define DUMP_BITMAP
|
||||
|
||||
@ -22,24 +22,6 @@
|
||||
#include <errno.h>
|
||||
#include "red_common.h"
|
||||
|
||||
|
||||
static inline void set_bit(int index, uint32_t *addr)
|
||||
{
|
||||
uint32_t mask = 1 << index;
|
||||
__sync_or_and_fetch(addr, mask);
|
||||
}
|
||||
|
||||
static inline void clear_bit(int index, uint32_t *addr)
|
||||
{
|
||||
uint32_t mask = ~(1 << index);
|
||||
__sync_and_and_fetch(addr, mask);
|
||||
}
|
||||
|
||||
static inline int test_bit(int index, uint32_t val)
|
||||
{
|
||||
return val & (1u << index);
|
||||
}
|
||||
|
||||
enum {
|
||||
RED_WORKER_PENDING_WAKEUP,
|
||||
RED_WORKER_PENDING_OOM,
|
||||
|
||||
23
server/spice_server_utils.h
Normal file
23
server/spice_server_utils.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef H_SPICE_SERVER_UTIL
|
||||
#define H_SPICE_SERVER_UTIL
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
static inline void set_bit(int index, uint32_t *addr)
|
||||
{
|
||||
uint32_t mask = 1 << index;
|
||||
__sync_or_and_fetch(addr, mask);
|
||||
}
|
||||
|
||||
static inline void clear_bit(int index, uint32_t *addr)
|
||||
{
|
||||
uint32_t mask = ~(1 << index);
|
||||
__sync_and_and_fetch(addr, mask);
|
||||
}
|
||||
|
||||
static inline int test_bit(int index, uint32_t val)
|
||||
{
|
||||
return val & (1u << index);
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue
Block a user