You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #115 I mentioned what I believe are current limitations to support overlapped IO in ReadFile.
I investigated a bit and, maybe, if...
ReadFile instantiates a Python bytearray (which is mutable) as the read buffer.
Uses ffi.from_buffer(bytearray) as the lpBuffer for ReadFile
Returns that bytearray as the result
...then the OS will be able to write the data there and the caller, now holding a reference to that mutable bytearray, can access it (after GetOverlappedResult or equivalent signals its ok, of course).
I'm just not sure about:
Memory ownership / leaks that can result from this approach (needs thinking).
How Pythonic such an approach is: call ReadFile and get a muttable buffer which will change under your feet, once the overlapped IO is completed.
The text was updated successfully, but these errors were encountered:
Memory ownership / leaks that can result from this approach (needs thinking).
I think that's managed by cffi, but it's probably something we could test.
How Pythonic such an approach is: call ReadFile and get a muttable buffer which will change under your feet, once the overlapped IO is completed.
I wouldn't call it Pythonic but I would said it's probably fairly standard from a Windows perspective. Considering pywincffi is wrapping Windows functions it's probably better to be more windows-like in cases like this than Pythonic (which should make the behavior more predictable).
In #115 I mentioned what I believe are current limitations to support overlapped IO in ReadFile.
I investigated a bit and, maybe, if...
...then the OS will be able to write the data there and the caller, now holding a reference to that mutable bytearray, can access it (after GetOverlappedResult or equivalent signals its ok, of course).
I'm just not sure about:
The text was updated successfully, but these errors were encountered: