diff options
author | rpj <rpj> | 2011-05-06 02:11:50 +0000 |
---|---|---|
committer | rpj <rpj> | 2011-05-06 02:11:50 +0000 |
commit | 2fe8aba6a8a4ce09f353f34881c77f93a9c01ca3 (patch) | |
tree | fd7f179b1abaa525ec55e34bef23b12f8fd89021 /tests/test.h | |
parent | 941d7cf87c60b55342b51e0b0fcd748589b76167 (diff) |
Robust mutexes merged from devel branchpost_merge_with_ROBUST_MUTEXES
Diffstat (limited to 'tests/test.h')
-rw-r--r-- | tests/test.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/test.h b/tests/test.h index a6c2b60..639ee55 100644 --- a/tests/test.h +++ b/tests/test.h @@ -113,7 +113,9 @@ const char * error_string[] = { "ENOLCK", "ENOSYS", "ENOTEMPTY", - "EILSEQ" + "EILSEQ", + "EOWNERDEAD", + "ENOTRECOVERABLE" }; /* @@ -152,3 +154,25 @@ int assertE; #e,#o,#r, __FILE__, (int) __LINE__, error_string[assertE]), exit(1), 0)) #endif + +# define BEGIN_MUTEX_STALLED_ROBUST(mxAttr) \ + for(;;) \ + { \ + static int _i=0; \ + static int _robust; \ + pthread_mutexattr_getrobust(&(mxAttr), &_robust); + +# define END_MUTEX_STALLED_ROBUST(mxAttr) \ + printf("Pass %s\n", _robust==PTHREAD_MUTEX_ROBUST?"Robust":"Non-robust"); \ + if (++_i > 1) \ + break; \ + else \ + { \ + pthread_mutexattr_t *pma, *pmaEnd; \ + for(pma = &(mxAttr), pmaEnd = pma + sizeof(mxAttr)/sizeof(pthread_mutexattr_t); \ + pma < pmaEnd; \ + pthread_mutexattr_setrobust(pma++, PTHREAD_MUTEX_ROBUST)); \ + } \ + } + +# define IS_ROBUST (_robust==PTHREAD_MUTEX_ROBUST) |