diff options
author | Ryo Nakamura <upa@haeena.net> | 2024-02-11 22:09:23 +0900 |
---|---|---|
committer | Ryo Nakamura <upa@haeena.net> | 2024-02-11 22:09:23 +0900 |
commit | f1522368446310ab697e2a60cd69119d741cf7cf (patch) | |
tree | d1bca5869100db4dcaa93707f9eeeec7c5997245 | |
parent | ce376beeb9d6f79692d955455b10dfff44cca3bb (diff) |
tiny fix on pool
-rw-r--r-- | src/mscp.c | 2 | ||||
-rw-r--r-- | src/pool.c | 2 | ||||
-rw-r--r-- | src/pool.h | 7 |
3 files changed, 5 insertions, 6 deletions
@@ -631,7 +631,7 @@ void *mscp_copy_thread(void *arg) goto err_out; } - if ((next_chunk_exist = pool_iter_check_next_lock(m->chunk_pool))) { + if ((next_chunk_exist = pool_iter_has_next_lock(m->chunk_pool))) { if (m->opts->interval > 0) wait_for_interval(m->opts->interval); pr_notice("thread[%d]: connecting to %s", t->id, m->remote); @@ -113,7 +113,7 @@ void *pool_iter_next_lock(pool *p) return v; } -bool pool_iter_check_next_lock(pool *p) +bool pool_iter_has_next_lock(pool *p) { bool next_exist; pool_lock(p); @@ -16,7 +16,6 @@ struct pool_struct { size_t len; /* length of array */ size_t num; /* number of items in the array */ size_t idx; /* index used dy iter */ - int state; lock lock; }; @@ -25,7 +24,7 @@ typedef struct pool_struct pool; /* allocate a new pool */ pool *pool_new(void); -/* func type applied to each item in a pool*/ +/* func type applied to each item in a pool */ typedef void (*pool_map_f)(void *v); /* apply f, which free an item, to all items and set num to 0 */ @@ -79,10 +78,10 @@ void *pool_get(pool *p, unsigned int idx); void *pool_iter_next(pool *p); void *pool_iter_next_lock(pool *p); -/* pool_iter_check_next_lock() returns true if pool_iter_next(_lock) +/* pool_iter_has_next_lock() returns true if pool_iter_next(_lock) * function will retrun a next value, otherwise false, which means * there is no more values in this iteration. */ -bool pool_iter_check_next_lock(pool *p); +bool pool_iter_has_next_lock(pool *p); #define pool_iter_for_each(p, v) \ pool_iter_init(p); \ |