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
06adddd4
Commit
06adddd4
authored
Jan 21, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
thread.allocate_lock
parent
24a56544
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
3 deletions
+23
-3
src/core/ast.cpp
src/core/ast.cpp
+2
-2
src/runtime/builtin_modules/thread.cpp
src/runtime/builtin_modules/thread.cpp
+18
-0
test/tests/thread_test.py
test/tests/thread_test.py
+3
-1
No files found.
src/core/ast.cpp
View file @
06adddd4
...
...
@@ -28,8 +28,8 @@ namespace pyston {
int
AST
::
next_lineno
=
100000
;
AST
::
AST
(
AST_TYPE
::
AST_TYPE
type
)
:
type
(
type
),
lineno
(
++
next_lineno
)
{
//if (lineno == 100644)
//
raise(SIGTRAP);
//
if (lineno == 100644)
//
raise(SIGTRAP);
}
#endif
...
...
src/runtime/builtin_modules/thread.cpp
View file @
06adddd4
...
...
@@ -45,9 +45,27 @@ Box* startNewThread(Box* target, Box* args) {
return
boxInt
(
thread_id
^
0x12345678901L
);
}
static
BoxedClass
*
thread_lock_cls
;
class
BoxedThreadLock
:
public
Box
{
public:
BoxedThreadLock
()
{}
DEFAULT_CLASS
(
thread_lock_cls
);
};
Box
*
allocateLock
()
{
return
new
BoxedThreadLock
();
}
void
setupThread
()
{
thread_module
=
createModule
(
"thread"
,
"__builtin__"
);
thread_module
->
giveAttr
(
"start_new_thread"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
startNewThread
,
BOXED_INT
,
2
)));
thread_module
->
giveAttr
(
"allocate_lock"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
allocateLock
,
UNKNOWN
,
0
)));
thread_lock_cls
=
new
BoxedHeapClass
(
object_cls
,
NULL
,
0
,
sizeof
(
BoxedThreadLock
),
false
);
thread_lock_cls
->
giveAttr
(
"__name__"
,
boxStrConstant
(
"lock"
));
thread_lock_cls
->
giveAttr
(
"__module__"
,
boxStrConstant
(
"thread"
));
thread_lock_cls
->
freeze
();
}
}
test/tests/thread_test.py
View file @
06adddd4
from
thread
import
start_new_thread
from
thread
import
start_new_thread
,
allocate_lock
import
time
print
type
(
allocate_lock
())
done
=
0
def
run
(
arg
):
global
done
...
...
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