I am using the "run" method in python that is running the web server. I want to make it thread safe by using mutex. How can i do this and where should i locate the mutex? Thanks.
def run(serverClass=FlsLdkServiceThreadedHttpServer, handlerClass=FlsLdkServiceRequestHandler, hostName="localhost", port=1111):
serverAddress = (hostName, int(port))
httpd = serverClass(serverAddress, handlerClass)
logging.info("start")
if sConfigIsSecure == "Yes":
httpd.socket = ssl.wrap_socket(httpd.socket, certfile=sConfigCert, keyfile=sConfigPrivKey, server_side=True)
try:
httpd.serve_forever()
except KeyboardInterrupt:
pass
httpd.server_close()
logging.info('Stop')