File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 20
20
21
21
#ifdef WITH_RSOCKET
22
22
23
+ #include <pthread.h>
24
+
23
25
/*
24
26
* Copy of defines from dynloader.h
25
27
*/
@@ -91,15 +93,22 @@ get_function(const char *name)
91
93
return func ;
92
94
}
93
95
96
+ static pthread_mutex_t rsocket_init_mutex = PTHREAD_MUTEX_INITIALIZER ;
97
+
94
98
/*
95
99
* Loads librdmacm and loads pointers to rsocket functions
96
100
*/
97
101
void
98
102
initialize_rsocket (void )
99
103
{
104
+ pthread_mutex_lock (rsocket_init_mutex );
105
+
100
106
/* librdmacm was loaded already */
101
107
if (rdmacm_handle != NULL )
108
+ {
109
+ pthread_mutex_unlock (rsocket_init_mutex );
102
110
return ;
111
+ }
103
112
104
113
rdmacm_handle = pg_dlopen (RDMACM_NAME );
105
114
if (rdmacm_handle == NULL )
@@ -159,6 +168,8 @@ initialize_rsocket(void)
159
168
#if !defined(WIN32 )
160
169
rcalls -> fcntl = get_function ("rfcntl" );
161
170
#endif
171
+
172
+ pthread_mutex_unlock (rsocket_init_mutex );
162
173
}
163
174
164
175
#endif /* WITH_RSOCKET */
You can’t perform that action at this time.
0 commit comments