summaryrefslogtreecommitdiffstats
path: root/server/red_dispatcher.c
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2011-11-06 16:09:35 +0200
committerAlon Levy <alevy@redhat.com>2011-11-07 10:29:32 +0200
commitaf77bb577d21215167d388f908584d797cc3c303 (patch)
tree1de9f4a330d6b219404cf77a8627dd94110994c8 /server/red_dispatcher.c
parentd5274eeef63872e6b3e0f4db6e1b2dbfcdf5580f (diff)
downloadspice-af77bb577d21215167d388f908584d797cc3c303.tar.gz
spice-af77bb577d21215167d388f908584d797cc3c303.tar.xz
spice-af77bb577d21215167d388f908584d797cc3c303.zip
server: add prefix argument to red_printf_debug
printed before function name. No central location for prefixes. Adding "WORKER", "ASYNC", "MAIN" since those were the current users.
Diffstat (limited to 'server/red_dispatcher.c')
-rw-r--r--server/red_dispatcher.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index c3cfa904..5257e6b4 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -44,6 +44,11 @@ static int num_active_workers = 0;
//volatile
+#define DBG_ASYNC(s, ...) \
+ do { \
+ red_printf_debug(2, "ASYNC", s, ##__VA_ARGS__); \
+ } while (0);
+
struct AsyncCommand {
RingItem link;
RedWorkerMessage message;
@@ -281,6 +286,7 @@ static AsyncCommand *async_command_alloc(RedDispatcher *dispatcher,
async_command->message = message;
ring_add(&dispatcher->async_commands, &async_command->link);
pthread_mutex_unlock(&dispatcher->async_lock);
+ DBG_ASYNC("%p", async_command);
return async_command;
}
@@ -385,7 +391,7 @@ red_dispatcher_destroy_primary_surface(RedDispatcher *dispatcher,
uint32_t surface_id, int async, uint64_t cookie)
{
RedWorkerMessage message;
- AsyncCommand *cmd;
+ AsyncCommand *cmd = NULL;
if (async) {
message = RED_WORKER_MESSAGE_DESTROY_PRIMARY_SURFACE_ASYNC;
@@ -429,7 +435,7 @@ red_dispatcher_create_primary_surface(RedDispatcher *dispatcher, uint32_t surfac
QXLDevSurfaceCreate *surface, int async, uint64_t cookie)
{
RedWorkerMessage message;
- AsyncCommand *cmd;
+ AsyncCommand *cmd = NULL;
if (async) {
message = RED_WORKER_MESSAGE_CREATE_PRIMARY_SURFACE_ASYNC;
@@ -490,7 +496,7 @@ static void red_dispatcher_destroy_surface_wait(RedDispatcher *dispatcher, uint3
int async, uint64_t cookie)
{
RedWorkerMessage message;
- AsyncCommand *cmd;
+ AsyncCommand *cmd = NULL;
if (async ) {
message = RED_WORKER_MESSAGE_DESTROY_SURFACE_WAIT_ASYNC;
@@ -835,9 +841,9 @@ void red_dispatcher_async_complete(struct RedDispatcher *dispatcher,
{
pthread_mutex_lock(&dispatcher->async_lock);
ring_remove(&async_command->link);
- red_printf_debug(2, "%p: cookie %" PRId64, async_command, async_command->cookie);
+ DBG_ASYNC("%p: cookie %" PRId64, async_command, async_command->cookie);
if (ring_is_empty(&dispatcher->async_commands)) {
- red_printf_debug(2, "%s: no more async commands", __func__);
+ red_printf_debug(2, "ASYNC", "no more async commands");
}
pthread_mutex_unlock(&dispatcher->async_lock);
switch (async_command->message) {
@@ -918,6 +924,7 @@ RedDispatcher *red_dispatcher_init(QXLInstance *qxl)
dispatcher = spice_new0(RedDispatcher, 1);
dispatcher->channel = channels[0];
ring_init(&dispatcher->async_commands);
+ DBG_ASYNC("dispatcher->async_commands.next %p", dispatcher->async_commands.next);
init_data.qxl = dispatcher->qxl = qxl;
init_data.id = qxl->id;
init_data.channel = channels[1];