src/flb_upstream.c
/* 'safe' version of prepare_destroy_conn. It set locks if necessary */
'safe' version of prepare_destroy_conn. It set locks if necessary
' safe ' version of prepare_destroy_conn . It set locks if necessary
static inline int prepare_destroy_conn_safe(struct flb_upstream_conn *u_conn)
{
    int ret;
    int locked = FLB_FALSE;
    struct flb_upstream *u = u_conn->u;
    if (u->thread_safe == FLB_TRUE) {
        ret = pthread_mutex_trylock(&u->mutex_lists);
        if (ret == 0) {
            locked = FLB_TRUE;
        }
    }
    ret = prepare_destroy_conn(u_conn);
    if (locked) {
        pthread_mutex_unlock(&u->mutex_lists);
    }
    return ret;
}
static inline int prepare_destroy_conn_safe ( struct flb_upstream_conn * u_conn ) { int ret ; int locked = FLB_FALSE ; struct flb_upstream * u = u_conn -> u ; if ( u -> thread_safe == FLB_TRUE ) { ret = pthread_mutex_trylock ( & u -> mutex_lists ) ; if ( ret == 0 ) { locked = FLB_TRUE ; } } ret = prepare_destroy_conn ( u_conn ) ; if ( locked ) { pthread_mutex_unlock ( & u -> mutex_lists ) ; } return ret ; }
'safe' version of prepare_destroy_conn.
' safe ' version of prepare_destroy_conn .