[MERGE] Cleanup and test Lock objects
Alexander Belchenko
bialix at ukr.net
Thu Mar 15 18:58:46 GMT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
John Arbash Meinel пишет:
> Alexander Belchenko wrote:
>> John Arbash Meinel ?8H5B:
>
>>>> + class _ctypes_FileLock(_base_Lock):
>>>> +
>>>> + def _lock(self, filename, openmode, lockmode):
>>>> + self._open(filename, openmode)
>>>> +
>>>> + self.hfile = msvcrt.get_osfhandle(self.f.fileno())
>>>> + overlapped = OVERLAPPED()
>>>> + p_overlapped = ctypes.pointer(overlapped)
>> ^-- In my own programs I use ctypes.byref() function to pass pointer to some
>> struct in C-function as argument. I'm okay with your implementation though.
>
> Either way. I was looking for a way to get a pointer, and this is what I
> found in cytypes.
>
> Your idea is
>
> result = _LockFileEx(self.hfile,
> lockmode,
> 0,
> 0x7fffffff,
> 0x00000000,
> overlapped.byref(),
> )
>
> Is that correct?
No, ctypes-object does not have .byref method.
It should be actually: ctypes.byref(overlapped).
> I actually submitted this, because I thought you approved from my add-on
> patch.
Sorry for this. I vote on your second patch earlier and want to study big one as well,
but don't have the time to carefully read your big patch during this day.
I hope I help (a little).
> But I'm happy to do your cleanups and submit them.
>
> By the way, Alexander, my branch at:
>
> http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/locking
>
> now has proper support for updating the dirstate during 'bzr status'.
Great, thanks.
>
> It also has updated fcntl locks, so it exposes the same bugs in our
> code. (Places where we are opening the same tree 2 times, and expecting
> to be able to take a read and write lock at the same time).
>
> You may want to give it a look.
Definitely.
[µ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF+ZdmzYr338mxwCURArCgAJ9wWrFpmDe3CQJlVUPdKa6FFiFMWgCfePHN
1CuEFxk7aTfwg8a5HQR0Ri4=
=q8hD
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list