Skip to content

Commit

Permalink
tanzilli#3 Updated the registering from the polling event in wait_edge
Browse files Browse the repository at this point in the history
  • Loading branch information
kevba committed Feb 14, 2015
1 parent 9adf40f commit 26a4972
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ablib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,11 +1018,13 @@ def wait_edge(self,fd,callback,debouncingtime):
po.register(fd,select.EPOLLET)
while True:
events = po.poll()
po.unregister(fd)
timestamp=time.time()
if (timestamp-timestampprec>debouncingtime) and counter>0:
callback()
counter=counter+1
timestampprec=timestamp
po.register(fd,select.EPOLLET)

def set_edge(self,value,callback,debouncingtime=0):
if self.fd!=None:
Expand Down Expand Up @@ -1128,9 +1130,11 @@ def wait_edge(self,fd,callback):
po.register(fd,select.EPOLLET)
while True:
events = po.poll()
po.unregister(fd)
if counter>0:
callback()
counter=counter+1
po.register(fd,select.EPOLLET)

def set_edge(self,value,callback):
if self.fd!=None:
Expand Down Expand Up @@ -1810,9 +1814,11 @@ def wait_edge(self,fd,callback):
po.register(fd,select.EPOLLET)
while True:
events = po.poll()
po.unregister(fd)
if counter>0:
callback()
counter=counter+1
po.register(fd,select.EPOLLET)

def set_edge(self,value,callback):
if self.fd!=None:
Expand Down Expand Up @@ -2147,9 +2153,11 @@ def wait_edge(self,fd,callback):
po.register(fd,select.EPOLLET)
while True:
events = po.poll()
po.unregister(fd)
if counter>0:
callback()
counter=counter+1
po.register(fd,select.EPOLLET)

def set_edge(self,value,callback):
if self.fd!=None:
Expand Down

0 comments on commit 26a4972

Please sign in to comment.