mirror of
https://github.com/upa/mscp.git
synced 2026-03-07 08:07:31 +08:00
tiny fix on pool
This commit is contained in:
@@ -631,7 +631,7 @@ void *mscp_copy_thread(void *arg)
|
|||||||
goto err_out;
|
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)
|
if (m->opts->interval > 0)
|
||||||
wait_for_interval(m->opts->interval);
|
wait_for_interval(m->opts->interval);
|
||||||
pr_notice("thread[%d]: connecting to %s", t->id, m->remote);
|
pr_notice("thread[%d]: connecting to %s", t->id, m->remote);
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ void *pool_iter_next_lock(pool *p)
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pool_iter_check_next_lock(pool *p)
|
bool pool_iter_has_next_lock(pool *p)
|
||||||
{
|
{
|
||||||
bool next_exist;
|
bool next_exist;
|
||||||
pool_lock(p);
|
pool_lock(p);
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ struct pool_struct {
|
|||||||
size_t len; /* length of array */
|
size_t len; /* length of array */
|
||||||
size_t num; /* number of items in the array */
|
size_t num; /* number of items in the array */
|
||||||
size_t idx; /* index used dy iter */
|
size_t idx; /* index used dy iter */
|
||||||
int state;
|
|
||||||
lock lock;
|
lock lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -25,7 +24,7 @@ typedef struct pool_struct pool;
|
|||||||
/* allocate a new pool */
|
/* allocate a new pool */
|
||||||
pool *pool_new(void);
|
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);
|
typedef void (*pool_map_f)(void *v);
|
||||||
|
|
||||||
/* apply f, which free an item, to all items and set num to 0 */
|
/* 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(pool *p);
|
||||||
void *pool_iter_next_lock(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
|
* function will retrun a next value, otherwise false, which means
|
||||||
* there is no more values in this iteration. */
|
* 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) \
|
#define pool_iter_for_each(p, v) \
|
||||||
pool_iter_init(p); \
|
pool_iter_init(p); \
|
||||||
|
|||||||
Reference in New Issue
Block a user