From 6cf0cb6f31d8a4ee8d265ae6e51632ac9e826bf4 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 16 Mar 2026 01:53:36 +0000 Subject: And use it in sassclient --- src/libunixonacid/sassclient_cancel.c | 16 +++------------- src/libunixonacid/sassclient_sendv.c | 13 +++---------- 2 files changed, 6 insertions(+), 23 deletions(-) (limited to 'src/libunixonacid') diff --git a/src/libunixonacid/sassclient_cancel.c b/src/libunixonacid/sassclient_cancel.c index bc4273e..f56efd0 100644 --- a/src/libunixonacid/sassclient_cancel.c +++ b/src/libunixonacid/sassclient_cancel.c @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include #include @@ -14,18 +14,8 @@ int sassclient_cancel (sassclient *a, uint32_t id, tain const *deadline, tain *stamp) { - int e ; - - { - struct timespec ts ; - tain diff ; - tain_sub(&diff, deadline, stamp) ; - if (!timespec_from_tain_relative(&ts, &diff)) return 0 ; - e = pthread_mutex_timedlock(&a->connection_mutex, &ts) ; -// e = pthread_mutex_clocklock(&a->connection_mutex, CLOCK_MONOTONIC, &ts) ; - if (e) return (errno = e, 0) ; - } - + int e = pthread_mutex_tailock(&a->connection_mutex, deadline, stamp) ; + if (e) return (errno = e, 0) ; e = sassclient_cancel_internal(a, id, deadline, stamp) ; if (e) goto err ; gensetdyn_delete(&a->store, id) ; diff --git a/src/libunixonacid/sassclient_sendv.c b/src/libunixonacid/sassclient_sendv.c index 209462b..54d6a6e 100644 --- a/src/libunixonacid/sassclient_sendv.c +++ b/src/libunixonacid/sassclient_sendv.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -26,16 +27,8 @@ int sassclient_sendv (sassclient *a, uint32_t *cid, uint32_t flags, uint32_t tim struct iovec v[1 + n] ; if (len + 11 > UINT32_MAX) return (errno = ENAMETOOLONG, 0) ; - { - struct timespec ts ; - tain diff ; - tain_sub(&diff, deadline, stamp) ; - if (!timespec_from_tain_relative(&ts, &diff)) return 0 ; - e = pthread_mutex_timedlock(&a->connection_mutex, &ts) ; -// e = pthread_mutex_clocklock(&a->connection_mutex, CLOCK_MONOTONIC, &ts) ; - if (e) return (errno = e, 0) ; - } - + e = pthread_mutex_tailock(&a->connection_mutex, deadline, stamp) ; + if (e) return (errno = e, 0) ; if (!gensetdyn_new(&a->store, &id)) goto err ; v[0].iov_base = pack ; v[0].iov_len = 17 ; -- cgit v1.3.1