Skip to content

Commit

Permalink
Committing clang-format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Mar 20, 2024
1 parent ed1e66a commit 450288e
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 48 deletions.
4 changes: 2 additions & 2 deletions src/H5FDsubfiling/H5FDioc_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ typedef struct ioc_io_queue_entry {
bool in_progress;
uint32_t counter;

sf_work_request_t wk_req;
int wk_ret;
sf_work_request_t wk_req;
int wk_ret;

/* statistics */
#ifdef H5FD_IOC_COLLECT_STATS
Expand Down
12 changes: 6 additions & 6 deletions src/H5FDsubfiling/H5FDioc_threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
* file's subfiling context object
*/
typedef struct ioc_data_t {
ioc_io_queue_t io_queue;
H5TS_thread_t ioc_main_thread;
H5TS_pool_t *io_thread_pool;
int64_t sf_context_id;
ioc_io_queue_t io_queue;
H5TS_thread_t ioc_main_thread;
H5TS_pool_t *io_thread_pool;
int64_t sf_context_id;

atomic_int sf_ioc_ready;
atomic_int sf_shutdown_flag;
Expand Down Expand Up @@ -60,7 +60,7 @@ static double sf_queue_delay_time = 0.0;

/* Prototypes */
static H5TS_THREAD_RETURN_TYPE ioc_thread_main(void *arg);
static int ioc_main(ioc_data_t *ioc_data);
static int ioc_main(ioc_data_t *ioc_data);

static int ioc_file_queue_write_indep(sf_work_request_t *msg, int ioc_idx, int source, MPI_Comm comm,
uint32_t counter);
Expand Down Expand Up @@ -252,7 +252,7 @@ static H5TS_THREAD_RETURN_TYPE
ioc_thread_main(void *arg)
{
H5TS_thread_ret_t thread_ret = (H5TS_thread_ret_t)0;
ioc_data_t *ioc_data = (ioc_data_t *)arg;
ioc_data_t *ioc_data = (ioc_data_t *)arg;

/* Pass along the ioc_data_t */
ioc_main(ioc_data);
Expand Down
63 changes: 31 additions & 32 deletions src/H5TSpool.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@
/* Local Macros */
/****************/

#define H5TS_POOL_INIT \
#define H5TS_POOL_INIT \
{ \
H5TS_MUTEX_INITIALIZER, /* mutex */ \
H5TS_COND_INITIALIZER, /* cond */ \
false, /* active */ \
false, /* shutdown */ \
0, /* num_threads */ \
NULL, /* threads */ \
NULL, /* head (queue) */ \
NULL /* tail (queue) */ \
H5TS_COND_INITIALIZER, /* cond */ \
false, /* active */ \
false, /* shutdown */ \
0, /* num_threads */ \
NULL, /* threads */ \
NULL, /* head (queue) */ \
NULL /* tail (queue) */ \
}

/******************/
Expand All @@ -58,28 +58,28 @@

/* Thread pool task */
typedef struct H5TS_pool_task_t {
H5TS_thread_start_func_t func; /* Function to invoke with thread */
void *ctx; /* Context for task's function */
struct H5TS_pool_task_t *next; /* Pointer to next task */
H5TS_thread_start_func_t func; /* Function to invoke with thread */
void *ctx; /* Context for task's function */
struct H5TS_pool_task_t *next; /* Pointer to next task */
} H5TS_pool_task_t;

/* Thread pool */
struct H5TS_pool_t {
H5TS_mutex_t mutex; /* Mutex to control access to pool struct */
H5TS_mutex_t mutex; /* Mutex to control access to pool struct */
H5TS_cond_t cond;

bool active; /* Pool is active */
bool shutdown; /* Pool is shutting down */
unsigned num_threads; /* # of threads in pool */
H5TS_thread_t *threads; /* Array of worker threads in pool */
bool active; /* Pool is active */
bool shutdown; /* Pool is shutting down */
unsigned num_threads; /* # of threads in pool */
H5TS_thread_t *threads; /* Array of worker threads in pool */

H5TS_pool_task_t *head, *tail; /* Task queue */
H5TS_pool_task_t *head, *tail; /* Task queue */
};

/********************/
/* Local Prototypes */
/********************/
static herr_t H5TS__pool_free(H5TS_pool_t *pool);
static herr_t H5TS__pool_free(H5TS_pool_t *pool);
static H5TS_THREAD_RETURN_TYPE H5TS__pool_do(void *_pool);

/*********************/
Expand Down Expand Up @@ -157,9 +157,9 @@ H5TS__pool_free(H5TS_pool_t *pool)
static H5TS_THREAD_RETURN_TYPE
H5TS__pool_do(void *_pool)
{
H5TS_pool_t *pool = (H5TS_pool_t *)_pool; /* Pool for threads */
bool have_mutex = false; /* Whether we're holding the mutex */
H5TS_thread_ret_t ret_value = (H5TS_thread_ret_t)0;
H5TS_pool_t *pool = (H5TS_pool_t *)_pool; /* Pool for threads */
bool have_mutex = false; /* Whether we're holding the mutex */
H5TS_thread_ret_t ret_value = (H5TS_thread_ret_t)0;

FUNC_ENTER_PACKAGE_NAMECHECK_ONLY

Expand All @@ -181,7 +181,7 @@ H5TS__pool_do(void *_pool)

/* If there's a task, invoke it, else we're shutting down */
if (NULL != pool->head) {
H5TS_pool_task_t *task; /* Task to invoke */
H5TS_pool_task_t *task; /* Task to invoke */

/* Grab our task */
task = pool->head;
Expand Down Expand Up @@ -228,8 +228,8 @@ H5TS__pool_do(void *_pool)
herr_t
H5TS_pool_create(H5TS_pool_t **pool, unsigned num_threads)
{
H5TS_pool_t *new_pool = NULL; /* Newly created pool */
herr_t ret_value = SUCCEED;
H5TS_pool_t *new_pool = NULL; /* Newly created pool */
herr_t ret_value = SUCCEED;

FUNC_ENTER_PACKAGE_NAMECHECK_ONLY

Expand Down Expand Up @@ -294,9 +294,9 @@ H5TS_pool_create(H5TS_pool_t **pool, unsigned num_threads)
herr_t
H5TS_pool_add_task(H5TS_pool_t *pool, H5TS_thread_start_func_t func, void *ctx)
{
H5TS_pool_task_t *task = NULL; /* Task for function to invoke */
bool have_mutex = false; /* Whether we're holding the mutex */
herr_t ret_value = SUCCEED;
H5TS_pool_task_t *task = NULL; /* Task for function to invoke */
bool have_mutex = false; /* Whether we're holding the mutex */
herr_t ret_value = SUCCEED;

FUNC_ENTER_PACKAGE_NAMECHECK_ONLY

Expand All @@ -310,7 +310,7 @@ H5TS_pool_add_task(H5TS_pool_t *pool, H5TS_thread_start_func_t func, void *ctx)
if (H5_UNLIKELY(NULL == (task = H5FL_MALLOC(H5TS_pool_task_t))))
HGOTO_DONE(FAIL);
task->func = func;
task->ctx = ctx;
task->ctx = ctx;
task->next = NULL;

/* Acquire the mutex for the pool */
Expand All @@ -325,7 +325,7 @@ H5TS_pool_add_task(H5TS_pool_t *pool, H5TS_thread_start_func_t func, void *ctx)
/* Add task to pool's queue */
if (NULL != pool->tail) {
pool->tail->next = task;
pool->tail = task;
pool->tail = task;
}
else
pool->head = pool->tail = task;
Expand Down Expand Up @@ -359,8 +359,8 @@ H5TS_pool_add_task(H5TS_pool_t *pool, H5TS_thread_start_func_t func, void *ctx)
herr_t
H5TS_pool_destroy(H5TS_pool_t *pool)
{
bool have_mutex = false; /* Whether we're holding the mutex */
herr_t ret_value = SUCCEED;
bool have_mutex = false; /* Whether we're holding the mutex */
herr_t ret_value = SUCCEED;

FUNC_ENTER_PACKAGE_NAMECHECK_ONLY

Expand Down Expand Up @@ -399,4 +399,3 @@ H5TS_pool_destroy(H5TS_pool_t *pool)
} /* end H5TS_pool_destroy() */

#endif /* H5_HAVE_THREADSAFE */

15 changes: 7 additions & 8 deletions src/H5TSprivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@
#define H5TS_THREAD_RETURN_TYPE H5TS_thread_ret_t WINAPI
#else
/* Static initialization values */
#define H5TS_KEY_INITIALIZER (pthread_key_t)0
#define H5TS_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
#define H5TS_COND_INITIALIZER PTHREAD_COND_INITIALIZER
#define H5TS_ONCE_INITIALIZER PTHREAD_ONCE_INIT
#define H5TS_KEY_INITIALIZER (pthread_key_t)0
#define H5TS_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
#define H5TS_COND_INITIALIZER PTHREAD_COND_INITIALIZER
#define H5TS_ONCE_INITIALIZER PTHREAD_ONCE_INIT

/* Thread macros */
#define H5TS_thread_self() pthread_self()
Expand Down Expand Up @@ -88,22 +88,21 @@ typedef PINIT_ONCE_FN H5TS_once_init_func_t
#else
typedef pthread_t H5TS_thread_t;
typedef void *(*H5TS_thread_start_func_t)(void *);
typedef void *H5TS_thread_ret_t;
typedef void *H5TS_thread_ret_t;
typedef pthread_key_t H5TS_key_t;
typedef pthread_mutex_t H5TS_CAPABILITY("mutex") H5TS_mutex_t;
typedef pthread_cond_t H5TS_cond_t;
typedef pthread_once_t H5TS_once_t;
typedef void (*H5TS_once_init_func_t)(void);
#endif

/* Thread pool */
typedef struct H5TS_pool_t H5TS_pool_t;
/* Thread pool */
typedef struct H5TS_pool_t H5TS_pool_t;

/*****************************/
/* Library-private Variables */
/*****************************/


/***************************************/
/* Library-private Function Prototypes */
/***************************************/
Expand Down

0 comments on commit 450288e

Please sign in to comment.