summaryrefslogtreecommitdiff
path: root/tests/check/check-threadsafe.h
blob: e40cb4cb93c28dabf0aa543f7bc05899ad72f643 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33


#ifndef __CHECK_THREADSAFE_H__
#define __CHECK_THREADSAFE_H__

#include <gst/check/gstcheck.h>

/* Define thread safe versions of the tests */

#define ts_fail_unless(...)             \
  G_STMT_START {                        \
    g_mutex_lock (check_mutex);         \
    fail_unless (__VA_ARGS__);          \
    g_mutex_unlock (check_mutex);       \
  } G_STMT_END


#define ts_fail_if(...)                 \
  G_STMT_START {                        \
    g_mutex_lock (check_mutex);         \
    fail_if (__VA_ARGS__);              \
    g_mutex_unlock (check_mutex);       \
  } G_STMT_END


#define ts_fail(...)    \
  G_STMT_START {                        \
    g_mutex_lock (check_mutex);         \
    fail (__VA_ARGS__);                 \
    g_mutex_unlock (check_mutex);       \
  } G_STMT_END

#endif /* __CHECK_THREADSAFE_H__ */