summaryrefslogtreecommitdiff
path: root/src/path.c
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2023-05-07 21:05:05 +0900
committerRyo Nakamura <upa@haeena.net>2023-05-07 21:05:05 +0900
commit24e86f58d87d48864e6ae33f1953124e467753ea (patch)
tree5bd65f8dd40209b6aaa08ca22c5224c059a22495 /src/path.c
parent1d3b3a2261153126832bab4276677cab6e262ed2 (diff)
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().
Diffstat (limited to 'src/path.c')
-rw-r--r--src/path.c12
1 files changed, 6 insertions, 6 deletions
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;
}