Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
1a20fdce
Commit
1a20fdce
authored
Feb 17, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to CPython's pthread library
parent
bff16616
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
519 additions
and
5 deletions
+519
-5
from_cpython/Include/pyconfig.h
from_cpython/Include/pyconfig.h
+1
-0
src/core/threading.cpp
src/core/threading.cpp
+0
-4
src/runtime/builtin_modules/thread.cpp
src/runtime/builtin_modules/thread.cpp
+32
-0
src/runtime/builtin_modules/thread_pthread.h
src/runtime/builtin_modules/thread_pthread.h
+479
-0
tools/lint.py
tools/lint.py
+7
-1
No files found.
from_cpython/Include/pyconfig.h
View file @
1a20fdce
...
...
@@ -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
...
...
src/core/threading.cpp
View file @
1a20fdce
...
...
@@ -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
...
...
src/runtime/builtin_modules/thread.cpp
View file @
1a20fdce
...
...
@@ -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
;
...
...
src/runtime/builtin_modules/thread_pthread.h
0 → 100644
View file @
1a20fdce
This diff is collapsed.
Click to expand it.
tools/lint.py
View file @
1a20fdce
...
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment