我正在运行Web服务器的python中使用“运行”方法。 我想通过使用互斥锁使其线程安全。 我该怎么办?我应该在哪里找到互斥体? 谢谢。
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')