[pypy-svn] r54946 - in pypy/branch/win32port/pypy: module/thread rpython/tool translator/c/src
afa at codespeak.net
afa at codespeak.net
Mon May 19 17:03:31 CEST 2008
Author: afa
Date: Mon May 19 17:03:28 2008
New Revision: 54946
Modified:
pypy/branch/win32port/pypy/module/thread/ll_thread.py
pypy/branch/win32port/pypy/rpython/tool/rffi_platform.py
pypy/branch/win32port/pypy/translator/c/src/thread_nt.h
Log:
Port module/thread to win32.
Modified: pypy/branch/win32port/pypy/module/thread/ll_thread.py
==============================================================================
--- pypy/branch/win32port/pypy/module/thread/ll_thread.py (original)
+++ pypy/branch/win32port/pypy/module/thread/ll_thread.py Mon May 19 17:03:28 2008
@@ -6,7 +6,7 @@
from pypy.rpython.annlowlevel import cast_instance_to_base_ptr
from pypy.translator.tool.cbuild import ExternalCompilationInfo
from pypy.rpython.lltypesystem import llmemory
-import thread, py
+import thread, py, os
from pypy.rpython.extregistry import ExtRegistryEntry
from pypy.annotation import model as annmodel
from pypy.rpython.lltypesystem.lltype import typeOf
@@ -17,15 +17,26 @@
error = thread.error
+_MS_WINDOWS = os.name == "nt"
+
+if not _MS_WINDOWS:
+ includes = ['unistd.h']
+else:
+ includes = []
+
eci = ExternalCompilationInfo(
- includes = ['unistd.h', 'src/thread.h'],
- separate_module_sources=['''
+ includes = includes + ['src/thread.h'],
+ separate_module_sources=[
+ '''
#include <Python.h>
#include <src/exception.h>
#include <src/thread.h>
'''],
include_dirs = [str(py.path.local(autopath.pypydir).join('translator', 'c')),
- python_inc]
+ python_inc],
+ export_symbols = ['RPyThreadGetIdent', 'RPyThreadLockInit',
+ 'RPyThreadAcquireLock', 'RPyThreadReleaseLock',
+ 'RPyThreadFusedReleaseAcquireLock',]
)
def llexternal(name, args, result, **kwds):
Modified: pypy/branch/win32port/pypy/rpython/tool/rffi_platform.py
==============================================================================
--- pypy/branch/win32port/pypy/rpython/tool/rffi_platform.py (original)
+++ pypy/branch/win32port/pypy/rpython/tool/rffi_platform.py Mon May 19 17:03:28 2008
@@ -530,8 +530,8 @@
"""
def run_example_code(filepath, eci):
- eci = eci.convert_sources_to_files()
- files = [filepath] + list(eci.separate_module_files)
+ eci = eci.convert_sources_to_files(being_main=True)
+ files = [filepath] + [py.path.local(f) for f in eci.separate_module_files]
output = build_executable_cache(files, eci)
section = None
for line in output.splitlines():
Modified: pypy/branch/win32port/pypy/translator/c/src/thread_nt.h
==============================================================================
--- pypy/branch/win32port/pypy/translator/c/src/thread_nt.h (original)
+++ pypy/branch/win32port/pypy/translator/c/src/thread_nt.h Mon May 19 17:03:28 2008
@@ -19,11 +19,6 @@
* Thread support.
*/
-/*
- * Return the thread Id instead of an handle. The Id is said to uniquely
- identify the thread in the system
- */
-#define RPyThreadGetIdent GetCurrentThreadId
#define RPyOpaque_INITEXPR_ThreadLock { 0, 0, NULL }
typedef struct {
@@ -54,6 +49,15 @@
#ifndef PYPY_NOT_MAIN_FILE
+/*
+ * Return the thread Id instead of an handle. The Id is said to uniquely
+ identify the thread in the system
+ */
+int RPyThreadGetIdent()
+{
+ return GetCurrentThreadId();
+}
+
static int
bootstrap(void *call)
{
@@ -201,7 +205,10 @@
/************************************************************/
-#define RPyThreadLockInit(lock) InitializeNonRecursiveMutex(lock)
+int RPyThreadLockInit(struct RPyOpaque_ThreadLock * lock)
+{
+ return InitializeNonRecursiveMutex(lock);
+}
void RPyOpaqueDealloc_ThreadLock(struct RPyOpaque_ThreadLock *lock)
{
More information about the Pypy-commit
mailing list