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
I will make the question more simple:
If two call to the "write" method of a file object "occur simultaneously "
is totally sure that the data of each call is writen successive or exist the
posibility of merge data?
where I can find information about this?
Thank in advance
Frank
> Hi again!
>
> I will make the question more simple:
>
> If two call to the "write" method of a file object "occur simultaneously "
> is totally sure that the data of each call is writen successive or exist the
> posibility of merge data?
Youv'e asked this before and failed to get an answer. I think you
failed to get an answer because there isn't a definitive one.
fileobject.c passes calls to the the write method to the C library
fwrite call. How that behaves under simultanious access depends on the
library implementation, and that probably depends on the underlying
OS. On Unix, that probably depends on how you got the file descriptors
the two file objects are using for I/O.
> where I can find information about this?
Check the C and system library documentation for the platform you're
running on.
If you want to make your code portable, don't do this.
<mike
--
Mike Meyer <m...@mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.