Skip to content

Instantly share code, notes, and snippets.

@trevorc
Created August 18, 2011 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trevorc/1155061 to your computer and use it in GitHub Desktop.
Save trevorc/1155061 to your computer and use it in GitHub Desktop.
Python segfault on Mac OS X 10.7
#include <pthread.h>
pthread_mutex_t mutex;
// compile and link with: cc -c mutex.c; ld -dylib -o libmutex.dylib mutex.o -lpthread
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