Commit 1a20fdce authored by Kevin Modzelewski's avatar Kevin Modzelewski

Switch to CPython's pthread library

parent bff16616
......@@ -27,6 +27,7 @@
#define SIZEOF_INT 4
#define SIZEOF_LONG 8
#define SIZEOF_LONG_LONG 8
#define SIZEOF_PTHREAD_T 8
#define HAVE_COPYSIGN 1
#define HAVE_ROUND 1
#define HAVE_HYPOT 1
......
......@@ -613,10 +613,6 @@ void allowGLReadPreemption() {
}
#endif
extern "C" long PyThread_get_thread_ident(void) noexcept {
return pthread_self();
}
// We don't support CPython's TLS (yet?)
extern "C" void PyThread_ReInitTLS(void) noexcept {
// don't have to do anything since we don't support TLS
......
......@@ -12,8 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include <pthread.h>
#include <stddef.h>
#include "Python.h"
#include "pythread.h"
#include "core/threading.h"
#include "core/types.h"
#include "runtime/objmodel.h"
......@@ -21,6 +25,34 @@
using namespace pyston::threading;
static int initialized;
static void PyThread__init_thread(void); /* Forward */
extern "C" void PyThread_init_thread(void) noexcept {
#ifdef Py_DEBUG
char* p = Py_GETENV("PYTHONTHREADDEBUG");
if (p) {
if (*p)
thread_debug = atoi(p);
else
thread_debug = 1;
}
#endif /* Py_DEBUG */
if (initialized)
return;
initialized = 1;
PyThread__init_thread();
}
/* Support for runtime thread stack size tuning.
A value of 0 means using the platform's default stack size
or the size specified by the THREAD_STACK_SIZE macro. */
static size_t _pythread_stacksize = 0;
#include "thread_pthread.h"
namespace pyston {
BoxedModule* thread_module;
......
This diff is collapsed.
......@@ -2,7 +2,13 @@ import os
import sys
def file_is_from_cpython(fn):
return 'from_cpython' in fn
if 'from_cpython' in fn:
return True
if fn.endswith("/thread_pthread.h"):
return True
return False
def verify_include_guard(_, dir, files):
for bn in files:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment