Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
acthon
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
Gwenaël Samain
acthon
Commits
ee853e23
Commit
ee853e23
authored
5 years ago
by
Gwenael Samain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API modification
parent
92a4c485
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
first_test.pyx
first_test.pyx
+8
-6
No files found.
first_test.pyx
View file @
ee853e23
...
...
@@ -4,14 +4,16 @@ from posix.unistd cimport sleep
cdef
extern
from
"Python.h"
:
void
Cy_INCREF
(
cyobject
o
)
nogil
cdef
cypclass
MessageInterface
nolock
cdef
cypclass
SyncInterface
nolock
:
bint
isActivable
(
self
):
pass
bint
isCompleted
(
self
):
pass
void
insert_activity
(
self
):
void
insert_activity
(
self
,
MessageInterface
msg
):
pass
void
remove_activity
(
self
):
void
remove_activity
(
self
,
MessageInterface
msg
):
pass
cdef
cypclass
MessageInterface
nolock
:
...
...
@@ -57,7 +59,7 @@ cdef cypclass BasicQueue(QueueInterface) nolock:
self
.
_queue
.
push_back
(
message
)
if
message
.
_sync_method
is
not
NULL
:
# prototype must change
message
.
_sync_method
.
insert_activity
()
message
.
_sync_method
.
insert_activity
(
message
)
# incref message
Cy_INCREF
(
message
)
# unlock queue
...
...
@@ -81,7 +83,7 @@ cdef cypclass BasicQueue(QueueInterface) nolock:
with
gil
:
print
(
"Top message processed, reporting to result class & deallocating"
)
if
next_message
.
_sync_method
is
not
NULL
:
next_message
.
_sync_method
.
remove_activity
()
next_message
.
_sync_method
.
remove_activity
(
next_message
)
#del next_message
else
:
with
gil
:
...
...
@@ -160,12 +162,12 @@ cdef cypclass ActivityCounterSync(SyncInterface) nolock:
self
.
count
=
0
self
.
previous_sync
=
prev
void
insert_activity
(
self
):
void
insert_activity
(
self
,
MessageInterface
msg
):
# lock self
self
.
count
+=
1
# unlock self
void
remove_activity
(
self
):
void
remove_activity
(
self
,
MessageInterface
msg
):
# lock self
self
.
count
-=
1
# unlock self
...
...
This diff is collapsed.
Click to expand it.
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