src/rdkafka.c
static int rd_kafka_init_wait (rd_kafka_t *rk, int timeout_ms) {
        struct timespec tspec;
        int ret;

        rd_timeout_init_timespec(&tspec, timeout_ms);

        mtx_lock(&rk->rk_init_lock);
        while (rk->rk_init_wait_cnt > 0 &&
               cnd_timedwait_abs(&rk->rk_init_cnd, &rk->rk_init_lock,
                                 &tspec) == thrd_success)
                ;
        ret = rk->rk_init_wait_cnt;
        mtx_unlock(&rk->rk_init_lock);

        return ret;
}
/**
 * @brief Wait for background threads to initialize.
 *
 * @returns the number of background threads still not initialized.
 *
 * @locality app thread calling rd_kafka_new()
 * @locks none
 */
@brief Wait for background threads to initialize.
@returns the number of background threads still not initialized.

@locality app thread calling rd_kafka_new()
@locks none
@brief Wait for background threads to initialize . @returns the number of background threads still not initialized . @locality app thread calling rd_kafka_new () @locks none
static int rd_kafka_init_wait (rd_kafka_t *rk, int timeout_ms) {
        struct timespec tspec;
        int ret;
        rd_timeout_init_timespec(&tspec, timeout_ms);
        mtx_lock(&rk->rk_init_lock);
        while (rk->rk_init_wait_cnt > 0 &&
               cnd_timedwait_abs(&rk->rk_init_cnd, &rk->rk_init_lock,
                                 &tspec) == thrd_success)
                ;
        ret = rk->rk_init_wait_cnt;
        mtx_unlock(&rk->rk_init_lock);
        return ret;
}
static int rd_kafka_init_wait ( rd_kafka_t * rk , int timeout_ms ) { struct timespec tspec ; int ret ; rd_timeout_init_timespec ( & tspec , timeout_ms ) ; mtx_lock ( & rk -> rk_init_lock ) ; while ( rk -> rk_init_wait_cnt > 0 && cnd_timedwait_abs ( & rk -> rk_init_cnd , & rk -> rk_init_lock , & tspec ) == thrd_success ) ; ret = rk -> rk_init_wait_cnt ; mtx_unlock ( & rk -> rk_init_lock ) ; return ret ; }
@brief Wait for background threads to initialize.
@brief Wait for background threads to initialize .