haskell / win32

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

Add Event bindings #160

Closed NCrashed closed 4 years ago

NCrashed commented 4 years ago

I needed WinAPI part for system wide events for process communication.

Description

The PR adds basic bindings for event creation, triggering and waiting/listening on them. Controversial change is that waitForMultipleObjects requires vector for Data.Vector.Storable for handy arrays of HANDLE.

Motivation and Context

The package completely missing bindings for events.

Types of changes

Checklist:

Mistuke commented 4 years ago

Oops, sorry I opened the PR and forgot to comment on it.

Unfortunately I can't take the dependency to Vector as this would transitively make Vector a bootstrapping library for GHC itself.

However looking at the usages of it, I don't see why you need it. Instead of Vector HANDLE you can just have [HANDLE]. I wouldn't mind Ptr HANDLE either if you don't want to force a representation.

NCrashed commented 4 years ago

I decided to use [HANDLE]. One can with ease make own helper for vector with raw C binding.

Mistuke commented 4 years ago

Awesome, thanks a lot!