use function lcp_timedwait_sec
parent
42c8a65a8f
commit
cce11f56cb
|
|
@ -74,20 +74,12 @@ static inline void idempotency_client_channel_set_id_key(
|
||||||
static inline int idempotency_client_channel_check_wait_ex(
|
static inline int idempotency_client_channel_check_wait_ex(
|
||||||
struct idempotency_client_channel *channel, const int timeout)
|
struct idempotency_client_channel *channel, const int timeout)
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
|
||||||
|
|
||||||
if (__sync_add_and_fetch(&channel->established, 0)) {
|
if (__sync_add_and_fetch(&channel->established, 0)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
idempotency_client_channel_check_reconnect(channel);
|
idempotency_client_channel_check_reconnect(channel);
|
||||||
PTHREAD_MUTEX_LOCK(&channel->lc_pair.lock);
|
lcp_timedwait_sec(&channel->lc_pair, timeout);
|
||||||
ts.tv_sec = get_current_time() + timeout;
|
|
||||||
ts.tv_nsec = 0;
|
|
||||||
pthread_cond_timedwait(&channel->lc_pair.cond,
|
|
||||||
&channel->lc_pair.lock, &ts);
|
|
||||||
PTHREAD_MUTEX_UNLOCK(&channel->lc_pair.lock);
|
|
||||||
|
|
||||||
return __sync_add_and_fetch(&channel->established, 0) ? 0 : ETIMEDOUT;
|
return __sync_add_and_fetch(&channel->established, 0) ? 0 : ETIMEDOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ typedef struct sf_binlog_writer_buffer_ring {
|
||||||
typedef struct binlog_writer_thread {
|
typedef struct binlog_writer_thread {
|
||||||
struct fast_mblock_man mblock;
|
struct fast_mblock_man mblock;
|
||||||
struct fc_queue queue;
|
struct fc_queue queue;
|
||||||
volatile bool running;
|
bool running;
|
||||||
bool use_fixed_buffer_size;
|
bool use_fixed_buffer_size;
|
||||||
short order_mode;
|
short order_mode;
|
||||||
short order_by;
|
short order_by;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue