concurrent access to object file

F

Frank Abel

Hi all!
I will build a HTTPServer and dislike that one request is handled at a time
(synchronous). So I write:

class MyHTTPServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):
....
....

For log the request and error I create a file and atteched it to the server
instance. Then the file log object can be see at RequestHandler instance
("self.server.log_file"). I overwrite in MyHTTPRequestHandler the methods
"log_message" to write instead of "sys.stderr" in my log file
"self.server.log_file".

My question is: Is posible that the log file crash (merge lines or some
other things) if two or more thread try to write in it "simultaneously" or
the write method of file object has a lock that prevent this?

Some other suggestion to get the aproach painted above?

Thank in advance
Frank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top