Personal tools
You are here: Home Issue Tracker @poll as a backgroud polling mechanism
Document Actions

#16 — @poll as a backgroud polling mechanism

State Resolved
Release:
Area Core Software
Issue type Feature
Severity Important
Submitted by Sébastien Lelong
Submitted on 2007-03-09
Responsible Sébastien Lelong
Target release:
Return to tracker
Last modified on 2007-04-03 by Sébastien Lelong
The SirBot communication model is a master/slave one. The core system is the master, the bot is the slave. So every order first comes from the PC. What if the bot needs to inform the system ("I'm the bot and there is a wall just over there !!!"). One possibility is to provide an easy way to regurlarly poll the bot. Ok, that's not a real bi-directionnal model, but that's a start, keeping the whole quite simple :)
Added by Sébastien Lelong on 2007-03-09 15:48
Issue state: unconfirmedopen
Added by Sébastien Lelong on 2007-03-09 15:51
Issue state: openin-progress
The idea is:

@poll(every=0.1)
def check_wall(self):
   # checking the wall

Calling self.check_wall() will make the code called every 0.1 seconds, in the background. So this would require the use of threads. So far so good.

But the problem is when the serial link (or other communicator objects) is concurently accessed. One solution is to use a semaphore in the CommunicationManager object. Every access to send/receive will acquire and release the semaphore. If there's a concurrent access, the acquire step will block.
Added by Sébastien Lelong on 2007-04-03 16:24
Issue state: in-progressresolved
Done...
module jobs declares IJob and IJobManager. Implements as:
 * a basic Job(Thread)
 * a simple JobManager, will can register jobs by name

@poll provides an easy way to declare methods as background tasks.

Powered by My Hands Powered by Jalv2 Hosted by Google Code