[IronPython] IronPython2.7 import locking error

Dino Viehland dinov at microsoft.com
Fri Mar 25 19:14:40 CET 2011


It looks like the CRT implements this by calling the LockFile/UnlockFile Win32 APIs (potentially retrying w/ 1 second between tries depending on the mode) so we could do that ourselves w/ the OS file handles.

-----Original Message-----
From: Jeff Hardy [mailto:jdhardy at gmail.com] 
Sent: Friday, March 25, 2011 11:08 AM
To: Discussion of IronPython
Cc: Dino Viehland
Subject: Re: [IronPython] IronPython2.7 import locking error

On Thu, Mar 24, 2011 at 6:41 PM, Dino Viehland <dinov at microsoft.com> wrote:
> Oh I see I missed the line containing msvcrt.  This just looks like it hasn't been implemented (we still have only a very partially implemented version of msvcrt).  It should be trivial to do add this , it should just be a P/Invoke out to msvcrt100, if someone wants to provide a patch.

It seems to me that msvcrt.locking is actually quite tricky, as it normally uses the CRT file handles when calling the locking functions.
We'd have to emulate the behavior using the .NET locking functions (or rewrite all of our file APIs to use the CRT).

- Jeff




More information about the Ironpython-users mailing list