From: <svn...@op...> - 2009-03-28 15:26:44
|
Author: dgollub Date: Sat Mar 28 16:26:33 2009 New Revision: 5379 URL: http://www.opensync.org/changeset/5379 Log: Fix regression of ipc_callback_break caused by r5360. refs #1039 comment:5 fixes #1039 Modified: trunk/tests/ipc-tests/check_ipc.c Modified: trunk/tests/ipc-tests/check_ipc.c ============================================================================== --- trunk/tests/ipc-tests/check_ipc.c Sat Mar 28 16:02:45 2009 (r5378) +++ trunk/tests/ipc-tests/check_ipc.c Sat Mar 28 16:26:33 2009 (r5379) @@ -1548,8 +1548,8 @@ END_TEST int stop_after = 500; -GCond *callback_handler2_cond; -GMutex *callback_handler2_mutex; +GCond *callback_handler2_cond = NULL; +GMutex *callback_handler2_mutex = NULL; void callback_handler2(OSyncMessage *message, void *user_data) { @@ -1565,9 +1565,11 @@ num_msgs++; - g_mutex_lock(callback_handler2_mutex); - g_cond_signal(callback_handler2_cond); - g_mutex_unlock(callback_handler2_mutex); + if (callback_handler2_mutex && callback_handler2_cond) { + g_mutex_lock(callback_handler2_mutex); + g_cond_signal(callback_handler2_cond); + g_mutex_unlock(callback_handler2_mutex); + } osync_trace(TRACE_EXIT, "%s", __func__); } @@ -1638,9 +1640,6 @@ osync_queue_create(client_queue, &error); fail_unless(error == NULL, NULL); char *data = "this is another test string"; - - callback_handler2_cond = g_cond_new(); - callback_handler2_mutex = g_mutex_new(); pid_t cpid = fork(); if (cpid == 0) { //Child @@ -1709,18 +1708,6 @@ osync_message_unref(message); - /* Send and process one by one and wait for the call - * of the server callback. This avoids that the pipe - * break (e.g. disconnect call) happens to early. - * - * With the disconnect call the queues get flushed - * and the callback_handler2 function would get - * immeditally the error messages. Which is not expected - * or designed in this testcase. - * - * (related) Fixes #1039 - */ - g_cond_wait(callback_handler2_cond, callback_handler2_mutex); } message = osync_queue_get_message(client_queue); @@ -1755,11 +1742,6 @@ osync_queue_unref(client_queue); osync_queue_unref(server_queue); - - g_mutex_free(callback_handler2_mutex); - g_cond_free(callback_handler2_cond); - callback_handler2_cond = NULL; - callback_handler2_mutex = NULL; destroy_testbed(testbed); } |