Skip to content

Commit

Permalink
concurrence.event.pyx: MAJOR RACE CONDITION FIXED
Browse files Browse the repository at this point in the history
  • Loading branch information
amlinux committed Sep 30, 2012
1 parent 3e16eb8 commit c067073
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/concurrence/concurrence._event.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,26 @@ cdef class __event:
def delete(self):
if event_del(&self.ev) == -1:
raise EventError("could not delete event")
# Remove the trigger from list of already triggered (but not processed) events
global head
global tail
cdef __list* cur
cdef __list* prev
cur = head
prev = NULL
while cur != NULL:
if cur == &self.trig:
if cur == tail:
# Delete last node
tail = prev
if cur == head:
# Delete first node
head = head.next
else:
# Delete not first node
prev.next = cur.next
prev = cur
cur = cur.next

def __dealloc__(self):
self.delete()
Expand Down

0 comments on commit c067073

Please sign in to comment.