File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 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()
7272 pthread_join (t , NULL );
7373}
7474
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+
7582void * probe_worker_runfn (void * arg )
7683{
7784 dD ("probe_worker_runfn has started" );
@@ -88,6 +95,8 @@ void *probe_worker_runfn(void *arg)
8895# endif
8996#endif
9097 dD ("handling SEAP message ID %u" , pair -> pth -> sid );
98+ pthread_cleanup_push (pthread_pair_cleanup_handler , (void * )pair );
99+
91100 //
92101 probe_ret = -1 ;
93102 probe_res = pair -> pth -> msg_handler (pair -> probe , pair -> pth -> msg , & probe_ret );
@@ -172,6 +181,8 @@ void *probe_worker_runfn(void *arg)
172181 free (pair );
173182 pthread_detach (pthread_self ());
174183
184+ pthread_cleanup_pop (0 );
185+
175186 dD ("probe_worker_runfn has finished" );
176187 return (NULL );
177188}
You can’t perform that action at this time.
0 commit comments