Skip to content

Commit 0745b45

Browse files
opal/mca/threads: minor cleanup
- Remove unnecessary header files - Remove weird empty lines - Add parenthesis for macros Signed-off-by: Shintaro Iwasaki <[email protected]>
1 parent dfb9f09 commit 0745b45

File tree

5 files changed

+31
-38
lines changed

5 files changed

+31
-38
lines changed

opal/mca/threads/argobots/threads_argobots_mutex.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131

3232
#include "opal_config.h"
3333

34-
#include <errno.h>
3534
#include <stdio.h>
3635
#include <string.h>
3736

opal/mca/threads/base/mutex.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626

2727
#include "opal_config.h"
2828

29-
#include <errno.h>
30-
#include <pthread.h>
31-
3229
#include "opal/constants.h"
3330
#include "opal/mca/threads/mutex.h"
3431

opal/mca/threads/mutex.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ typedef struct opal_mutex_t opal_recursive_mutex_t;
5353

5454
struct opal_mutex_t {
5555
opal_object_t super;
56-
5756
opal_thread_internal_mutex_t m_lock;
58-
5957
#if OPAL_ENABLE_DEBUG
6058
int m_lock_debug;
6159
const char *m_lock_file;

opal/mca/threads/qthreads/threads_qthreads_mutex.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
#include "opal_config.h"
3434

35-
#include <errno.h>
3635
#include <stdio.h>
3736

3837
#include "opal/class/opal_object.h"

opal/mca/threads/wait_sync.h

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -58,30 +58,30 @@ typedef struct ompi_wait_sync_t {
5858
* as possible. Note that the race window is small so spinning here
5959
* is more optimal than sleeping since this macro is called in
6060
* the critical path. */
61-
#define WAIT_SYNC_RELEASE(sync) \
62-
if (opal_using_threads()) { \
63-
while ((sync)->signaling) { \
64-
if (OPAL_THREAD_YIELD_WHEN_IDLE_DEFAULT) { \
65-
opal_thread_yield(); \
66-
} \
67-
continue; \
68-
} \
69-
opal_thread_internal_cond_destroy(&(sync)->condition); \
70-
opal_thread_internal_mutex_destroy(&(sync)->lock); \
61+
#define WAIT_SYNC_RELEASE(sync) \
62+
if (opal_using_threads()) { \
63+
while ((sync)->signaling) { \
64+
if (OPAL_THREAD_YIELD_WHEN_IDLE_DEFAULT) { \
65+
opal_thread_yield(); \
66+
} \
67+
continue; \
68+
} \
69+
opal_thread_internal_cond_destroy(&((sync)->condition)); \
70+
opal_thread_internal_mutex_destroy(&((sync)->lock)); \
7171
}
7272

73-
#define WAIT_SYNC_RELEASE_NOWAIT(sync) \
74-
if (opal_using_threads()) { \
75-
opal_thread_internal_cond_destroy(&(sync)->condition); \
76-
opal_thread_internal_mutex_destroy(&(sync)->lock); \
73+
#define WAIT_SYNC_RELEASE_NOWAIT(sync) \
74+
if (opal_using_threads()) { \
75+
opal_thread_internal_cond_destroy(&((sync)->condition)); \
76+
opal_thread_internal_mutex_destroy(&((sync)->lock)); \
7777
}
7878

79-
#define WAIT_SYNC_SIGNAL(sync) \
80-
if (opal_using_threads()) { \
81-
opal_thread_internal_mutex_lock(&(sync->lock)); \
82-
opal_thread_internal_cond_signal(&sync->condition); \
83-
opal_thread_internal_mutex_unlock(&(sync->lock)); \
84-
sync->signaling = false; \
79+
#define WAIT_SYNC_SIGNAL(sync) \
80+
if (opal_using_threads()) { \
81+
opal_thread_internal_mutex_lock(&((sync)->lock)); \
82+
opal_thread_internal_cond_signal(&((sync)->condition)); \
83+
opal_thread_internal_mutex_unlock(&((sync)->lock)); \
84+
(sync)->signaling = false; \
8585
}
8686

8787
#define WAIT_SYNC_SIGNALLED(sync) \
@@ -110,17 +110,17 @@ static inline int sync_wait_st(ompi_wait_sync_t *sync)
110110
return sync->status;
111111
}
112112

113-
#define WAIT_SYNC_INIT(sync, c) \
114-
do { \
115-
(sync)->count = (c); \
116-
(sync)->next = NULL; \
117-
(sync)->prev = NULL; \
118-
(sync)->status = 0; \
119-
(sync)->signaling = (0 != (c)); \
120-
if (opal_using_threads()) { \
121-
opal_thread_internal_cond_init(&(sync)->condition); \
122-
opal_thread_internal_mutex_init(&(sync)->lock, false); \
123-
} \
113+
#define WAIT_SYNC_INIT(sync, c) \
114+
do { \
115+
(sync)->count = (c); \
116+
(sync)->next = NULL; \
117+
(sync)->prev = NULL; \
118+
(sync)->status = 0; \
119+
(sync)->signaling = (0 != (c)); \
120+
if (opal_using_threads()) { \
121+
opal_thread_internal_cond_init(&((sync)->condition)); \
122+
opal_thread_internal_mutex_init(&((sync)->lock), false); \
123+
} \
124124
} while (0)
125125

126126
/**

0 commit comments

Comments
 (0)