haskell / win32

Haskell support for the Win32 API
http://hackage.haskell.org/package/Win32
Other
97 stars 63 forks source link

createFile without busy-wait #208

Closed joeyh closed 2 years ago

joeyh commented 2 years ago

createFile uses failIfWithRetry, and in my application, that busy-waiting for up to 2 seconds got in the way. I want to be able to open a file and give up immediately if there's something else that has it open.

I used to use c_createFile for this, but it got removed in https://github.com/haskell/win32/issues/174

I see that was an accidental export, but would you consider exporting the same functionality under some better name?

Mistuke commented 2 years ago

Hi, Yes I'm happy to export it under a different name

joeyh commented 2 years ago

Cool. I don't want to bikeshed on a name, but would it perhaps make sense to have a separate module for the closer-to-the-metal versions of functions?

Mistuke commented 2 years ago

No, close to the metal was always the intended version of the functions. It's an exception when there's a wrapper around it.

That createFile has the convenience functionality exposed under the default name is am exception.

joeyh commented 2 years ago

Thanks for merging this @Mistuke!

I don't know what your plans are for a release, but it would be helpful to me if this could get released sometime soonish. I am blocked from updating to a current stack lts by this, and so am stuck building against an old version of aeson that has a security hole..

Mistuke commented 2 years ago

Oh I think I simply forgot to do a release. I'll do it now.

Mistuke commented 2 years ago

Releasing through #215