1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
 herr_t
 ss_aio_finalize(void)
 {
     SS_ENTER(ss_aio_finalize, herr_t);

 #ifdef SSLIB_ASYNC_THREADS
     if (ss_aio_g.handler_started) {
         int en;
         pthread_mutex_lock(&(ss_aio_g.mutex));
         ss_aio_g.do_exit = 1;
         pthread_cond_signal(&(ss_aio_g.cond));
         pthread_mutex_unlock(&(ss_aio_g.mutex));

         en = pthread_join(ss_aio_g.handler, NULL);
         if (en) SS_ERROR_FMT(FAILED, ("pthread_join failed: %s", strerror(en)));
     }
 SS_CLEANUP:
 #endif
     SS_LEAVE(0);
 }