summaryrefslogtreecommitdiff
path: root/memcached.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2021-07-29 16:29:22 -0700
committerdormando <dormando@rydia.net>2021-08-09 17:09:08 -0700
commitd89ecd3456138c226934ddcdde749e3ba90a45a7 (patch)
tree166dc6db7d2af4838d03fda65671b1dc9ea3b97c /memcached.c
parent331dca5d644edefd99893c44827bdf2ca72f85be (diff)
downloadmemcached-d89ecd3456138c226934ddcdde749e3ba90a45a7.tar.gz
thread: unify worker notify interface
worker notification was a mix of reading data from pipe or examining a an object queue stack. now it's all one interface. this is necessary to switch signalling to eventfd or similar, since we won't have that pipe to work with.
Diffstat (limited to 'memcached.c')
-rw-r--r--memcached.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/memcached.c b/memcached.c
index 60c027f..a029061 100644
--- a/memcached.c
+++ b/memcached.c
@@ -301,11 +301,9 @@ static pthread_cond_t conn_timeout_cond = PTHREAD_COND_INITIALIZER;
static pthread_mutex_t conn_timeout_lock = PTHREAD_MUTEX_INITIALIZER;
#define CONNS_PER_SLICE 100
-#define TIMEOUT_MSG_SIZE (1 + sizeof(int))
static void *conn_timeout_thread(void *arg) {
int i;
conn *c;
- char buf[TIMEOUT_MSG_SIZE];
rel_time_t oldest_last_cmd;
int sleep_time;
int sleep_slice = max_fds / CONNS_PER_SLICE;
@@ -341,11 +339,7 @@ static void *conn_timeout_thread(void *arg) {
continue;
if ((current_time - c->last_cmd_time) > settings.idle_timeout) {
- buf[0] = 't';
- memcpy(&buf[1], &i, sizeof(int));
- if (write(c->thread->notify_send_fd, buf, TIMEOUT_MSG_SIZE)
- != TIMEOUT_MSG_SIZE)
- perror("Failed to write timeout to notify pipe");
+ timeout_conn(c);
} else {
if (c->last_cmd_time < oldest_last_cmd)
oldest_last_cmd = c->last_cmd_time;