Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xavier Thompson
cython
Commits
2fd7bc9f
Commit
2fd7bc9f
authored
Dec 18, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change acthon interfaces
parent
98a93bc2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
18 deletions
+17
-18
Cython/Compiler/Builtin.py
Cython/Compiler/Builtin.py
+5
-6
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+1
-1
Cython/Utility/CyObjects.cpp
Cython/Utility/CyObjects.cpp
+2
-2
tests/run/cypclass_acthon.pyx
tests/run/cypclass_acthon.pyx
+9
-9
No files found.
Cython/Compiler/Builtin.py
View file @
2fd7bc9f
...
...
@@ -510,9 +510,8 @@ def inject_acthon_interfaces(self):
sync_isCompleted_entry
.
is_variable
=
1
sync_scope
.
var_entries
.
append
(
sync_isCompleted_entry
)
sync_msg_arg
=
PyrexTypes
.
CFuncTypeArg
(
"msg"
,
message_type
,
None
)
sync_insertActivity_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_void_type
,
[
sync_msg_arg
],
nogil
=
1
)
sync_removeActivity_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_void_type
,
[
sync_msg_arg
],
nogil
=
1
)
sync_insertActivity_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_void_type
,
[],
nogil
=
1
)
sync_removeActivity_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_void_type
,
[],
nogil
=
1
)
sync_insertActivity_entry
=
sync_scope
.
declare
(
"insertActivity"
,
"insertActivity"
,
sync_insertActivity_type
,
None
,
"extern"
)
sync_insertActivity_entry
.
is_cfunction
=
1
...
...
@@ -533,12 +532,12 @@ def inject_acthon_interfaces(self):
message_entry
.
is_type
=
1
message_sync_attr_entry
=
message_scope
.
declare
(
"_sync_method"
,
"_sync_method"
,
sync_type
,
None
,
"extern"
)
PyrexTypes
.
cyp_class_qualified_type
(
sync_type
,
'locked'
)
,
None
,
"extern"
)
message_sync_attr_entry
.
is_variable
=
1
message_scope
.
var_entries
.
append
(
message_sync_attr_entry
)
message_result_attr_entry
=
message_scope
.
declare
(
"_result"
,
"_result"
,
result_type
,
None
,
"extern"
)
PyrexTypes
.
cyp_class_qualified_type
(
result_type
,
'locked'
)
,
None
,
"extern"
)
message_result_attr_entry
.
is_variable
=
1
message_scope
.
var_entries
.
append
(
message_result_attr_entry
)
...
...
@@ -564,7 +563,7 @@ def inject_acthon_interfaces(self):
queue_entry
.
is_type
=
1
queue_msg_arg
=
PyrexTypes
.
CFuncTypeArg
(
"msg"
,
message_type
,
None
)
queue_push_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_void_type
,
[
queue_msg_arg
],
nogil
=
1
)
queue_push_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_void_type
,
[
queue_msg_arg
],
nogil
=
1
,
self_qualifier
=
'locked&'
)
queue_push_entry
=
queue_scope
.
declare
(
"push"
,
"push"
,
queue_push_type
,
None
,
"extern"
)
queue_push_entry
.
is_cfunction
=
1
...
...
Cython/Compiler/Symtab.py
View file @
2fd7bc9f
...
...
@@ -2850,7 +2850,7 @@ class CppClassScope(Scope):
# create the sync argument type
activated_method_sync_attr_type
=
PyrexTypes
.
CFuncTypeArg
(
EncodedString
(
"sync_method"
),
PyrexTypes
.
CConstOrVolatileType
(
sync_type
,
is_const
=
1
),
PyrexTypes
.
cyp_class_qualified_type
(
sync_type
,
'locked'
),
entry
.
pos
,
"sync_method"
,
)
...
...
Cython/Utility/CyObjects.cpp
View file @
2fd7bc9f
...
...
@@ -364,8 +364,8 @@
struct
ActhonSyncInterface
:
public
CyObject
{
virtual
int
isActivable
()
const
=
0
;
virtual
int
isCompleted
()
const
=
0
;
virtual
void
insertActivity
(
ActhonMessageInterface
*
msg
)
=
0
;
virtual
void
removeActivity
(
ActhonMessageInterface
*
msg
)
=
0
;
virtual
void
insertActivity
()
=
0
;
virtual
void
removeActivity
()
=
0
;
};
struct
ActhonMessageInterface
:
public
CyObject
{
...
...
tests/run/cypclass_acthon.pyx
View file @
2fd7bc9f
...
...
@@ -26,10 +26,10 @@ cdef cypclass BasicQueue(ActhonQueueInterface):
bint
is_empty
(
const
self
):
return
self
.
_queue
.
empty
()
void
push
(
self
,
ActhonMessageInterface
message
):
void
push
(
locked
&
self
,
ActhonMessageInterface
message
):
self
.
_queue
.
push_back
(
message
)
if
message
.
_sync_method
is
not
NULL
:
message
.
_sync_method
.
insertActivity
(
message
)
message
.
_sync_method
.
insertActivity
()
bint
activate
(
self
):
cdef
bint
one_message_processed
...
...
@@ -47,7 +47,7 @@ cdef cypclass BasicQueue(ActhonQueueInterface):
if
next_message
.
_sync_method
is
not
NULL
:
next_sync_method
=
next_message
.
_sync_method
with
wlocked
next_sync_method
:
next_sync_method
.
removeActivity
(
next_message
)
next_sync_method
.
removeActivity
()
else
:
self
.
_queue
.
push_back
(
next_message
)
# Don't forget to incref to avoid premature deallocation
...
...
@@ -106,16 +106,16 @@ cdef cypclass WaitResult(ActhonResultInterface):
cdef
cypclass
ActivityCounterSync
(
ActhonSyncInterface
):
int
count
ActivityCounterSync
previous_sync
locked
ActivityCounterSync
previous_sync
__init__
(
self
,
ActivityCounterSync
prev
=
<
ActivityCounterSync
>
NULL
):
__init__
(
self
,
locked
ActivityCounterSync
prev
=
NULL
):
self
.
count
=
0
self
.
previous_sync
=
prev
void
insertActivity
(
self
,
ActhonMessageInterface
msg
):
void
insertActivity
(
self
):
self
.
count
+=
1
void
removeActivity
(
self
,
ActhonMessageInterface
msg
):
void
removeActivity
(
self
):
self
.
count
-=
1
bint
isCompleted
(
const
self
):
...
...
@@ -147,8 +147,8 @@ def test_acthon_chain(n):
"""
cdef
ActhonResultInterface
res
cdef
locked
ActhonQueueInterface
queue
sync1
=
ActivityCounterSync
()
after_sync1
=
ActivityCounterSync
(
sync1
)
sync1
=
<
locked
ActivityCounterSync
>
consume
ActivityCounterSync
()
after_sync1
=
<
locked
ActivityCounterSync
>
consume
ActivityCounterSync
(
sync1
)
obj
=
A
()
queue
=
obj
.
_active_queue_class
...
...
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