Axon Release Notes

1.1.2

Summary

Instated use of ctypes to use posix.sched_yield during the main loop. This makes the system a *little* bit more other-system friendly.

Added in the ability to do, effectively, blocking calls to other components. The best example using this at present in Kamaelia.UI.Pygame.Ticker

Specifically you can ask the system to run a different microprocess in the place of the running one, and wait until it ends.

     yield WaitComplete(
    self.requestDisplay(DISPLAYREQUEST=True,
    callback = (self,"control"),
    size = (self.render_area.width, self.render_area.height),
    position = self.position
    )
    )

Where self.requestDisplay is a generator with the following behaviour:

    def requestDisplay(self, **argd):
    displayservice = PygameDisplay.getDisplayService()
    self.link((self,"signal"), displayservice)
    self.send(argd, "signal")
    for _ in self.waitBox("control"): yield 1 ## This could also be rewritten in this form :-)
    display = self.recv("control")
    self.display = display

This is experimental support that is likely to evolve with time. This does however allow effectively for a far more co-routine type behaviour than we had in place before - rather than generator type behaviour.

Detailed Changelog

Changed Files:

Axon.Component.component:

  • Added introspectable documentation to the purposes of the default inboxes and outboxes. component.Inboxes["inbox"] gives you documentation on that inbox

Axon.Ipc.py:

  • WaitComplete
    New IPC class allowing components to signal to the scheduler that they'd like a generator started, run to completion and then control handed back to the original generator. This is similar, in a way, to call with continuation or similar to nesting yields in a system like greenlets, but having the stacking of frames essentially handled by main system.

    This is experimental support initially. This will probably become more generalised with time, but for the moment it's put in place to cover a specific use case - getting a pygame display. This is likely to be useful in a variety of locations however.
  • reactivate is a sister IPC function to reactivate the original generator (ie main()) when the call is finished.

Axon/Microprocess.py:

  • microprocess class constructor extended to allow a generator object to be be passed in as the __thread of control for the microprocess. This is to support the WaitComplete functionality. This means arbitrary generators can be embdedded into a microprocess and scheduled, without creating a new class for the generator. (This has scope for use outside the core of Kamaelia of course).

    It has also been extended to allow the addition of a closeDownValue. This is a value the scheduler can look at when the microprocess finishes and can decide what to do next. An example would be to reactivate a previous thread of control using the new 'IPC' message "reactivate".

Axon/Scheduler.py:

  • A number of changes. The bulk of code change relates to code deletion. Specifically the deletion of debugging code that has not been need in over a year now. Clearly this could be re-instated easily in a targetted fashion, but for now is not needed.
  • The addition of code supporting the new experimental WaitComplete functionality. (Experimental in terms of "what can it do", not in terms of "does it work" - it works.)
  • The instatement of the use of ctypes (conditional import) to allow the scheduler to periodically make a posix.sched_yield call.
  • Change to add in a method for handleMicroprocessShutdownKnockon to handle shutdown of items postmen, and WaitComplete objects.
  • self.time added - which means a generator can now find out system time by querying self.scheduler.time. It isn't clear if this is a good or bad idea as yet.

 

Kamaelia is an open source project originated from and guided by BBC Research. For more information browse the site or get in contact.

This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC. (the site is powered by a wiki engine)

(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved

This web site is powered by the same code created for the bicker manor project. For more details, contact Michael Sparks at BBC Research directly (cf contact)