def doit(self): # test pause and resume self.change_parameters() self.file_output.pause() self.change_parameters() self.file_output.resume() self.change_parameters() # test pause until event fires self.e1 = gs.event() self.file_output.pause(self.e1) self.change_parameters() self.e1.notify() self.change_parameters()
# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA # # ENDLICENSETEXT import gs import sys e0 = gs.event() e1 = gs.event() e2 = gs.event() e3 = gs.event() e4 = gs.event() def producer(): print "producer:", gs.time(), "start" print "producer:", gs.time(), "notify e0 after 1ns" e0.notify(1) print "producer:", gs.time(), "notify e1 after 8ns" e1.notify(8) print "producer:", gs.time(), "notify e2 after 5ns" e2.notify(5) print "producer:", gs.time(), "notify e3 after 3ns"
# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA # # ENDLICENSETEXT import gs e1 = gs.event() e2 = gs.event() e3 = gs.event() def test1(): print "test1:", gs.time(), "start" print "test1:", gs.time(), "wait for 10 default units (ns)" gs.wait(10) print "test1:", gs.time(), "notify e1 in the same delta" e1.notify() print "test1:", gs.time(), "wait for one delta" gs.wait(0) print "test1:", gs.time(), "at this delta e1 was already notified"
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA # # ENDLICENSETEXT import gs import sys e0 = gs.event() e1 = gs.event() e2 = gs.event() e3 = gs.event() e4 = gs.event() def producer(): print "producer:", gs.time(), "start" print "producer:", gs.time(), "notify e0 after 1ns" e0.notify(1) print "producer:", gs.time(), "notify e1 after 8ns" e1.notify(8) print "producer:", gs.time(), "notify e2 after 5ns" e2.notify(5) print "producer:", gs.time(), "notify e3 after 3ns"
# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA # # ENDLICENSETEXT import gs e1 = gs.event() e2 = gs.event() e3 = gs.event() def test1(): print "test1:", gs.time(), "start" print "test1:", gs.time(), "wait for 10 default units (ns)" gs.wait(10) print "test1:", gs.time(), "notify e1 in the same delta" e1.notify() print "test1:", gs.time(), "wait for one delta" gs.wait(0) print "test1:", gs.time(), "at this delta e1 was already notified"