summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2024-02-11 22:09:23 +0900
committerRyo Nakamura <upa@haeena.net>2024-02-11 22:09:23 +0900
commitf1522368446310ab697e2a60cd69119d741cf7cf (patch)
treed1bca5869100db4dcaa93707f9eeeec7c5997245
parentce376beeb9d6f79692d955455b10dfff44cca3bb (diff)
tiny fix on pool
-rw-r--r--src/mscp.c2
-rw-r--r--src/pool.c2
-rw-r--r--src/pool.h7
3 files changed, 5 insertions, 6 deletions
diff --git a/src/mscp.c b/src/mscp.c
index 2f4490f..474d6fa 100644
--- a/src/mscp.c
+++ b/src/mscp.c
@@ -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);
diff --git a/src/pool.c b/src/pool.c
index d67295e..e357425 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -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);
diff --git a/src/pool.h b/src/pool.h
index 875a84b..aa4baa5 100644
--- a/src/pool.h
+++ b/src/pool.h
@@ -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); \