D
Dominik Kaspar
maybe my question was badly formulated. i give it a new try:
why does the following program give the output "0 0" and not "1 0"?
why does it loop forever? and how could that problem be fixed?
import threading
class Server(threading.Thread):
running = 0
def run(self):
running = 1
while running:
print "do something here..."
def stop(self):
running = 0
server = Server()
server.start()
print server.running # should print "1"
server.stop()
print server.running # should print "0"
why does the following program give the output "0 0" and not "1 0"?
why does it loop forever? and how could that problem be fixed?
import threading
class Server(threading.Thread):
running = 0
def run(self):
running = 1
while running:
print "do something here..."
def stop(self):
running = 0
server = Server()
server.start()
print server.running # should print "1"
server.stop()
print server.running # should print "0"