Skip to content

Commit 3a80436

Browse files
committed
thread: verify that no locks are held after the user function returns
Signed-off-by: Josef 'Jeff' Sipek <[email protected]>
1 parent 2933eb1 commit 3a80436

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

thread.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*/
2222

2323
#include <jeffpc/thread.h>
24+
#include <jeffpc/synch.h>
2425
#include <jeffpc/error.h>
2526
#include <jeffpc/mem.h>
2627

@@ -32,11 +33,16 @@ struct xthr_info {
3233
static void *xthr_setup(void *_info)
3334
{
3435
struct xthr_info info = *((struct xthr_info *) _info);
36+
void *ret;
3537

3638
/* free early since the function may run for a very long time */
3739
free(_info);
3840

39-
return info.f(info.arg);
41+
ret = info.f(info.arg);
42+
43+
lockdep_no_locks();
44+
45+
return ret;
4046
}
4147

4248
int xthr_create(pthread_t *restrict thread, void *(*start)(void*),

0 commit comments

Comments
 (0)