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 27, 2024
1 parent f68db6d commit a834eee
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 36 deletions.
4 changes: 2 additions & 2 deletions src/H5FDsubfiling/H5FDioc_threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -1325,8 +1325,8 @@ ioc_io_queue_add_entry(ioc_data_t *ioc_data, sf_work_request_t *wk_req_ptr)
if (ioc_data->io_queue.q_len != H5TS_atomic_load_int(&ioc_data->sf_io_ops_pending)) {
H5_subfiling_log(
wk_req_ptr->context_id,
"%s: ioc_data->io_queue->q_len = %d != %d = H5TS_atomic_load_int(&ioc_data->sf_io_ops_pending).", __func__,
ioc_data->io_queue.q_len, H5TS_atomic_load_int(&ioc_data->sf_io_ops_pending));
"%s: ioc_data->io_queue->q_len = %d != %d = H5TS_atomic_load_int(&ioc_data->sf_io_ops_pending).",
__func__, ioc_data->io_queue.q_len, H5TS_atomic_load_int(&ioc_data->sf_io_ops_pending));
}
#endif

Expand Down
22 changes: 10 additions & 12 deletions src/H5TSatomic.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ H5TS_atomic_init_int(H5TS_atomic_int_t *obj, int desired)
{
FUNC_ENTER_NOAPI_NAMECHECK_ONLY

/* Initialize mutex that protects the "atomic" value */
(void)H5TS_mutex_init(&obj->mutex);
/* Initialize mutex that protects the "atomic" value */
(void) H5TS_mutex_init(&obj->mutex);

/* Set the value */
obj->value = desired;
Expand All @@ -102,8 +102,8 @@ H5TS_atomic_load_int(H5TS_atomic_int_t *obj)

FUNC_ENTER_NOAPI_NAMECHECK_ONLY

/* Lock mutex that protects the "atomic" value */
(void)H5TS_mutex_lock(&obj->mutex);
/* Lock mutex that protects the "atomic" value */
(void) H5TS_mutex_lock(&obj->mutex);

/* Get the value */
ret_value = obj->value;
Expand All @@ -128,8 +128,8 @@ H5TS_atomic_store_int(H5TS_atomic_int_t *obj, int desired)
{
FUNC_ENTER_NOAPI_NAMECHECK_ONLY

/* Lock mutex that protects the "atomic" value */
(void)H5TS_mutex_lock(&obj->mutex);
/* Lock mutex that protects the "atomic" value */
(void) H5TS_mutex_lock(&obj->mutex);

/* Set the value */
obj->value = desired;
Expand Down Expand Up @@ -158,8 +158,8 @@ H5TS_atomic_fetch_add_int(H5TS_atomic_int_t *obj, int arg)

FUNC_ENTER_NOAPI_NAMECHECK_ONLY

/* Lock mutex that protects the "atomic" value */
(void)H5TS_mutex_lock(&obj->mutex);
/* Lock mutex that protects the "atomic" value */
(void) H5TS_mutex_lock(&obj->mutex);

/* Get the current value */
ret_value = obj->value;
Expand Down Expand Up @@ -191,8 +191,8 @@ H5TS_atomic_fetch_sub_int(H5TS_atomic_int_t *obj, int arg)

FUNC_ENTER_NOAPI_NAMECHECK_ONLY

/* Lock mutex that protects the "atomic" value */
(void)H5TS_mutex_lock(&obj->mutex);
/* Lock mutex that protects the "atomic" value */
(void) H5TS_mutex_lock(&obj->mutex);

/* Get the current value */
ret_value = obj->value;
Expand All @@ -209,5 +209,3 @@ H5TS_atomic_fetch_sub_int(H5TS_atomic_int_t *obj, int arg)
#endif /* H5_HAVE_THREADS_H */

#endif /* H5_HAVE_THREADSAFE */


23 changes: 11 additions & 12 deletions src/H5TSprivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
/* Include package's public headers */
#include "H5TSdevelop.h"


/**************************/
/* Library Private Macros */
/**************************/
Expand Down Expand Up @@ -72,11 +71,11 @@

/* Atomics macros */
#ifdef H5_HAVE_STDATOMIC_H
#define H5TS_atomic_init_int(obj, desired) atomic_init((obj), (desired))
#define H5TS_atomic_load_int(obj) atomic_load(obj)
#define H5TS_atomic_store_int(obj, desired) atomic_store((obj), (desired))
#define H5TS_atomic_fetch_add_int(obj, arg) atomic_fetch_add((obj), (arg))
#define H5TS_atomic_fetch_sub_int(obj, arg) atomic_fetch_sub((obj), (arg))
#define H5TS_atomic_init_int(obj, desired) atomic_init((obj), (desired))
#define H5TS_atomic_load_int(obj) atomic_load(obj)
#define H5TS_atomic_store_int(obj, desired) atomic_store((obj), (desired))
#define H5TS_atomic_fetch_add_int(obj, arg) atomic_fetch_add((obj), (arg))
#define H5TS_atomic_fetch_sub_int(obj, arg) atomic_fetch_sub((obj), (arg))
#endif /* H5_HAVE_STDATOMIC_H */

/****************************/
Expand Down Expand Up @@ -108,7 +107,7 @@ typedef DWORD H5TS_key_t;
typedef CRITICAL_SECTION H5TS_CAPABILITY("mutex") H5TS_mutex_t;
typedef CONDITION_VARIABLE H5TS_cond_t;
typedef PINIT_ONCE H5TS_once_t;
typedef PINIT_ONCE_FN H5TS_once_init_func_t
typedef PINIT_ONCE_FN H5TS_once_init_func_t
#else
typedef pthread_t H5TS_thread_t;
typedef void *(*H5TS_thread_start_func_t)(void *);
Expand All @@ -125,9 +124,9 @@ typedef void (*H5TS_once_init_func_t)(void);
#ifdef H5_HAVE_STDATOMIC_H
typedef atomic_int H5TS_atomic_int_t;
#else
typedef struct {
typedef struct {
H5TS_mutex_t mutex;
int value;
int value;
} H5TS_atomic_int_t;
#endif

Expand Down Expand Up @@ -192,10 +191,10 @@ H5_DLL herr_t H5TS_pool_destroy(H5TS_pool_t *pool);
/* Emulated C11 atomics */
#ifndef H5_HAVE_STDATOMIC_H
H5_DLL void H5TS_atomic_init_int(H5TS_atomic_int_t *obj, int desired);
H5_DLL int H5TS_atomic_load_int(H5TS_atomic_int_t *obj);
H5_DLL int H5TS_atomic_load_int(H5TS_atomic_int_t *obj);
H5_DLL void H5TS_atomic_store_int(H5TS_atomic_int_t *obj, int desired);
H5_DLL int H5TS_atomic_fetch_add_int(H5TS_atomic_int_t *obj, int arg);
H5_DLL int H5TS_atomic_fetch_sub_int(H5TS_atomic_int_t *obj, int arg);
H5_DLL int H5TS_atomic_fetch_add_int(H5TS_atomic_int_t *obj, int arg);
H5_DLL int H5TS_atomic_fetch_sub_int(H5TS_atomic_int_t *obj, int arg);
#endif /* H5_HAVE_STDATOMIC_H */

#else /* H5_HAVE_THREADSAFE */
Expand Down
19 changes: 9 additions & 10 deletions test/ttsafe_atomic.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ static H5TS_atomic_int_t counter_g;
static H5TS_THREAD_RETURN_TYPE
noop_task(void *_counter)
{
H5TS_atomic_int_t *counter = (H5TS_atomic_int_t *)_counter;
H5TS_thread_ret_t ret_value = 0;
H5TS_atomic_int_t *counter = (H5TS_atomic_int_t *)_counter;
H5TS_thread_ret_t ret_value = 0;

VERIFY(H5TS_atomic_load_int(counter), 0, "noop_task");

Expand All @@ -38,8 +38,8 @@ noop_task(void *_counter)
static H5TS_THREAD_RETURN_TYPE
incr_task(void *_counter)
{
H5TS_atomic_int_t *counter = (H5TS_atomic_int_t *)_counter;
H5TS_thread_ret_t ret_value = 0;
H5TS_atomic_int_t *counter = (H5TS_atomic_int_t *)_counter;
H5TS_thread_ret_t ret_value = 0;

H5TS_atomic_fetch_add_int(counter, 1);

Expand All @@ -49,8 +49,8 @@ incr_task(void *_counter)
static H5TS_THREAD_RETURN_TYPE
decr_task(void *_counter)
{
H5TS_atomic_int_t *counter = (H5TS_atomic_int_t *)_counter;
H5TS_thread_ret_t ret_value = 0;
H5TS_atomic_int_t *counter = (H5TS_atomic_int_t *)_counter;
H5TS_thread_ret_t ret_value = 0;

H5TS_atomic_fetch_sub_int(counter, 1);

Expand Down Expand Up @@ -117,7 +117,7 @@ tts_atomics(void)

/* Create pool, add pair of 'incr' & 'decr' tasks, destroy pool */
H5TS_atomic_store_int(&counter_g, 10);
result = H5TS_pool_create(&pool, NUM_THREADS);
result = H5TS_pool_create(&pool, NUM_THREADS);
CHECK_I(result, "H5TS_pool_create");

result = H5TS_pool_add_task(pool, incr_task, &counter_g);
Expand All @@ -133,7 +133,7 @@ tts_atomics(void)

/* Create pool, add many 'incr' & 'decr' tasks, destroy pool */
H5TS_atomic_store_int(&counter_g, 3);
result = H5TS_pool_create(&pool, NUM_THREADS);
result = H5TS_pool_create(&pool, NUM_THREADS);
CHECK_I(result, "H5TS_pool_create");

for (unsigned u = 0; u < 200; u++) {
Expand All @@ -153,7 +153,7 @@ tts_atomics(void)

/* Create pool, add *lots* of 'incr' & 'decr' tasks, destroy pool */
H5TS_atomic_store_int(&counter_g, 5);
result = H5TS_pool_create(&pool, NUM_THREADS);
result = H5TS_pool_create(&pool, NUM_THREADS);
CHECK_I(result, "H5TS_pool_create");

for (unsigned u = 0; u < 2 * 1000 * 1000; u++) {
Expand All @@ -178,4 +178,3 @@ tts_atomics(void)
} /* end tts_atomics() */

#endif /*H5_HAVE_THREADSAFE*/

0 comments on commit a834eee

Please sign in to comment.