Skip to content

Conversation

sheaf
Copy link
Contributor

@sheaf sheaf commented Sep 2, 2022

Description

This PR adds support for Windows Semaphores. I mostly followed the information on this page and its linked pages.

This is my first time contributing to this library, so there might be some obvious oversights. Thanks.

Motivation and Context

This adds a counterpart to the posix semaphore functionality offered by the unix package, which I am interested in using in ghc to improve contention with package-level parallelism.

Types of changes

  • New feature

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have not added a new Haskell dependency.
  • I have included a changelog entry.
  • I have not modified the version of the package in Win32.cabal.
  • I have added tests for the new feature.

@sheaf sheaf force-pushed the semaphore branch 4 times, most recently from f79d025 to a5fe8c7 Compare September 5, 2022 17:36
@sheaf sheaf changed the title WIP: add Semaphore support Add Semaphore support Sep 5, 2022
@Mistuke
Copy link
Contributor

Mistuke commented Sep 5, 2022

Awesome! This is looking great, let me know whenever you're ready for a review! Thanks!

@sheaf
Copy link
Contributor Author

sheaf commented Sep 5, 2022

Awesome! This is looking great, let me know whenever you're ready for a review! Thanks!

Thanks, I think this is ready for review, now that I've got a test checking the functionality.

This adds the module `System.Win32.Semaphore` which implements
Windows semaphores and operations on them.

Note that waiting on a semaphore is done using
`System.Win32.Event.waitForSingleObject`, and freeing a semaphore
is done using `System.Win32.File.closeHandle`.
@Mistuke
Copy link
Contributor

Mistuke commented Sep 9, 2022

Thanks this looks perfect.

@Mistuke Mistuke merged commit 3fb78d4 into haskell:master Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants