Jim Davidson
Mon, 18 Jul 2005 16:36:09 -0700
Hi, You're right -- it's not thread safe. Two options:1. Add the offset & length parameters and have the server use pread as you suggest (not sure about the equivalent on win32). I suppose this would technically not be backward compatible in case someone was expecting the current seek position to change as a result of the call so perhaps a new API such as Ns_ConnReturnSharedFd may make more sense.
2. Mmap the file and allow multiple threads to use Ns_ConnReturnData. You should be able to do this in user code now.
-Jim On Jul 12, 2005, at 1:05 AM, Fred Cox wrote:
If multiple threads have the same file open, and would like to send portions of it back to the clients, Ns_ConnReturnOpenFd() is close to being useful, but it fails because a seek() must be done before before calling the API. Also, the documentation incorrectly states that the full file will be sent, ignoring the length parameter. A version that ultimately uses pread() instead of read() would be useful in this case, but I suppose it doesn't fit the FILE * paradigm. I don't know about Tcl channels, so I can't say whether it makes from that perspective. For now, I'm working around this by reading the portion of the file into a buffer on the stack and doing Ns_ConnReturnData(). Would it be worth while to append an offset parameter just for the FD case? Fred ____________________________________________________ Sell on Yahoo! Auctions – no fees. Bid on great items. http://auctions.yahoo.com/ -- AOLserver - http://www.aolserver.com/To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.
-- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.