Created
August 18, 2011 20:12
-
-
Save trevorc/1155061 to your computer and use it in GitHub Desktop.
Python segfault on Mac OS X 10.7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pthread.h> | |
pthread_mutex_t mutex; | |
// compile and link with: cc -c mutex.c; ld -dylib -o libmutex.dylib mutex.o -lpthread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ctypes | |
import ctypes.util | |
mutex = ctypes.cdll.LoadLibrary('./libmutex.dylib') | |
pthread = ctypes.cdll.LoadLibrary(ctypes.util.find_library('pthread')) | |
pthread.pthread_mutex_init(ctypes.byref(mutex.mutex), None) | |
# segfaults from python gc on exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment