File tree 1 file changed +11
-0
lines changed
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,13 @@ static void preload_libraries_before_chroot()
72
72
pthread_join (t , NULL );
73
73
}
74
74
75
+ static void pthread_pair_cleanup_handler (void * arg )
76
+ {
77
+ probe_pwpair_t * pair = (probe_pwpair_t * )arg ;
78
+ dW ("Probe worker thread finished unxpectedly, trying to avoid deadlock now..." );
79
+ SEAP_replyerr (pair -> probe -> SEAP_ctx , pair -> probe -> sd , pair -> pth -> msg , -100 );
80
+ }
81
+
75
82
void * probe_worker_runfn (void * arg )
76
83
{
77
84
dD ("probe_worker_runfn has started" );
@@ -88,6 +95,8 @@ void *probe_worker_runfn(void *arg)
88
95
# endif
89
96
#endif
90
97
dD ("handling SEAP message ID %u" , pair -> pth -> sid );
98
+ pthread_cleanup_push (pthread_pair_cleanup_handler , (void * )pair );
99
+
91
100
//
92
101
probe_ret = -1 ;
93
102
probe_res = pair -> pth -> msg_handler (pair -> probe , pair -> pth -> msg , & probe_ret );
@@ -172,6 +181,8 @@ void *probe_worker_runfn(void *arg)
172
181
free (pair );
173
182
pthread_detach (pthread_self ());
174
183
184
+ pthread_cleanup_pop (0 );
185
+
175
186
dD ("probe_worker_runfn has finished" );
176
187
return (NULL );
177
188
}
You can’t perform that action at this time.
0 commit comments