File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -369,17 +369,24 @@ def start(cls):
369369 if cls .started :
370370 return
371371
372- if not tornado .ioloop .IOLoop .instance ().running ():
373- print ("Press Ctrl+C to stop server" )
374- try :
375- tornado .ioloop .IOLoop .instance ().start ()
376- except KeyboardInterrupt :
377- print ("Server stopped" )
378- else :
379- print ("Server is running in an existing Tornado IOLoop" )
380-
372+ # Set the flag to True *before* blocking on IOLoop.instance().start()
381373 cls .started = True
382374
375+ """
376+ IOLoop.running() was removed as of Tornado 2.4; see for example
377+ https://groups.google.com/forum/#!topic/python-tornado/QLMzkpQBGOY
378+ Thus there is no correct way to check if the loop has already been
379+ launched. We may end up with two concurrently running loops in that
380+ unlucky case with all the expected consequences.
381+ """
382+ print ("Press Ctrl+C to stop server" )
383+ try :
384+ tornado .ioloop .IOLoop .instance ().start ()
385+ except KeyboardInterrupt :
386+ print ("Server stopped" )
387+ finally :
388+ cls .started = False
389+
383390
384391def ipython_inline_display (figure ):
385392 import tornado .template
You can’t perform that action at this time.
0 commit comments