From: <svn...@op...> - 2009-03-02 15:40:02
|
Author: bellmich Date: Mon Mar 2 16:39:57 2009 New Revision: 964 URL: http://libsyncml.opensync.org/changeset/964 Log: If the lock is created to early then the called function of expr can potentially use a callback which calls sml_fail_unless too. The result is a deadlock because the called function expr waits for the lock which is already reserved. expr has not to be a function but it can be a function. Modified: trunk/tests/support.h Modified: trunk/tests/support.h ============================================================================== --- trunk/tests/support.h Mon Mar 2 15:50:50 2009 (r963) +++ trunk/tests/support.h Mon Mar 2 16:39:57 2009 (r964) @@ -46,8 +46,8 @@ #define sml_fail_unless(expr, ...);\ {\ - g_static_mutex_lock(&__libsyncml_check_mutex);\ int _result = expr;\ + g_static_mutex_lock(&__libsyncml_check_mutex);\ fail_unless(_result, ## __VA_ARGS__);\ if (!_result) smlAssertMsg(0, g_strdup_printf(__VA_ARGS__));\ g_static_mutex_unlock(&__libsyncml_check_mutex);\ |