[Stackless] hi all , can i implemented this function in game scripting engine?

zouguangxian zouguangxian at hotmail.com
Fri Oct 1 05:19:17 CEST 2004

hi all,
   i am a newbie in stackless python. but i am attracted by it .now i want to embed stackless python in my c++ program .i hope it can work in this way :
   there is a "event" list,some thread will put  "event" in it. and the script engine thread will pick "event" from this list. pseudocode may like this :

python_generator generator ;   // to save generator object,can i do this ?

while (1) {
   if (event==EVENT1) {
   } else (if event==EVENT2) {

void func1()
   generator.suspend; //point 1

  yes,when i receive EVENT1,the func1 was called,and after some statement,i hope it will be paused at point 1, but will block the main loop. when EVENT2 was received in main loop, then resume the func1,let it continue run from point 1. can i do in this way ? 
  maybe i should explain more . i want to embed stackless python in a game as scripting engine. maybe NPC will talk to player and wait the player to click on some button , I hope the tasklet (i think it is ,can i think so ?) will be  paused before the player click the button and will not block main loop. once the player click on some button , the tasklet will continue at the paused point .
  can you give me some advice ? do i need to use tasklet instead of generator ?do i need callback instead of tasklet(micro-thread) ?
-------------- next part --------------
Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list