From 24e86f58d87d48864e6ae33f1953124e467753ea Mon Sep 17 00:00:00 2001 From: Ryo Nakamura Date: Sun, 7 May 2023 21:05:05 +0900 Subject: mscp: maintain mscp_thread structs in list Instead of m->threads array, struct mscp_thread instanes are maintained in m->thread_list. This enables stable counter access via mscp_get_stats(). --- src/path.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/path.c') diff --git a/src/path.c b/src/path.c index ffa7fe9..7dbb9da 100644 --- a/src/path.c +++ b/src/path.c @@ -27,10 +27,10 @@ void chunk_pool_init(struct chunk_pool *cp) static void chunk_pool_add(struct chunk_pool *cp, struct chunk *c) { - LOCK_ACQUIRE_THREAD(&cp->lock); + LOCK_ACQUIRE(&cp->lock); list_add_tail(&c->list, &cp->list); cp->count += 1; - LOCK_RELEASE_THREAD(); + LOCK_RELEASE(); } void chunk_pool_set_filled(struct chunk_pool *cp) @@ -54,7 +54,7 @@ struct chunk *chunk_pool_pop(struct chunk_pool *cp) struct list_head *first; struct chunk *c = NULL; - LOCK_ACQUIRE_THREAD(&cp->lock); + LOCK_ACQUIRE(&cp->lock); first = cp->list.next; if (list_empty(&cp->list)) { if (!chunk_pool_is_filled(cp)) @@ -65,7 +65,7 @@ struct chunk *chunk_pool_pop(struct chunk_pool *cp) c = list_entry(first, struct chunk, list); list_del(first); } - LOCK_RELEASE_THREAD(); + LOCK_RELEASE(); /* return CHUNK_POP_WAIT would be very rare case, because it * means copying over SSH is faster than traversing @@ -363,7 +363,7 @@ static int prepare_dst_path(FILE *msg_fp, struct path *p, sftp_session dst_sftp) { int ret = 0; - LOCK_ACQUIRE_THREAD(&p->lock); + LOCK_ACQUIRE(&p->lock); if (p->state == FILE_STATE_INIT) { if (touch_dst_path(p, dst_sftp) < 0) { ret = -1; @@ -374,7 +374,7 @@ static int prepare_dst_path(FILE *msg_fp, struct path *p, sftp_session dst_sftp) } out: - LOCK_RELEASE_THREAD(); + LOCK_RELEASE(); return ret; } -- cgit v1.2.3