mirror of
https://github.com/plasma-umass/coz.git
synced 2024-09-17 15:57:16 +03:00
Merge pull request #238 from camelid/dlopen
Handle NULL return value from dlopen
This commit is contained in:
commit
985c15f533
@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "real.h"
|
#include "real.h"
|
||||||
|
#include "ccutil/log.h"
|
||||||
|
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
@ -37,6 +38,7 @@ static void* pthread_handle = NULL; //< The `dlopen` handle to libpthread
|
|||||||
static void* get_pthread_handle() {
|
static void* get_pthread_handle() {
|
||||||
if(pthread_handle == NULL && !__atomic_exchange_n(&in_dlopen, true, __ATOMIC_ACQ_REL)) {
|
if(pthread_handle == NULL && !__atomic_exchange_n(&in_dlopen, true, __ATOMIC_ACQ_REL)) {
|
||||||
pthread_handle = dlopen("libpthread.so.0", RTLD_NOW | RTLD_GLOBAL);
|
pthread_handle = dlopen("libpthread.so.0", RTLD_NOW | RTLD_GLOBAL);
|
||||||
|
REQUIRE(pthread_handle != NULL) << dlerror();
|
||||||
__atomic_store_n(&in_dlopen, false, __ATOMIC_RELEASE);
|
__atomic_store_n(&in_dlopen, false, __ATOMIC_RELEASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user