LIU Hao wrote:

> First, `LockCount` doesn't have to be 64-bit which would introduce some 
> complexity for 32-bit targets;
> and when using a 64-bit value, it's unnecessary to check for overflows which 
> could take hundreds of years.

I don't have strong opinion on this; if you think that using 64-bit lock count 
is unnecessary, then let's use 32-bit lock count. Can you apply the changes 
locally?

Another idea may be using 32-bit lock count for 32-bit targets and 64-bit lock 
count for 64-bit targets. I'm not sure if there's any value in doing so though.

> And, `CreateEventW()` fails on Windows 9x. Since you are not passing a name, 
> it can be equivalently
> replaced with `CreateEventA()`.

I've got a wrong impression that `CreateEventA` was not available on NT 3.1, 
similar to how locale function such as `GetLocaleInfoA` were only introduced in 
NT 3.5 and Win95. But looking at lib32/kernel32.def, it does not seem to be the 
case.

Perfectly, I think we should use `CreateEventW` on NT and `CreateEventA` on 
Win9x; "Unicode" APIs are present in kernel32.dll on Win9x systems, but they 
always fail.

However, I'm not sure if in the current state winphtreads is even loadable on 
Win9x systems and static winpthreads would be broken on Win9x due to lack of 
support for TLS callbacks in EXEs (thanks to Pali for investigating TLS 
behavior across Windows versions). I want to add support for old NT versions as 
well as Win9x systems. I would prioritize adding support for older NT versions 
before Win9x.

To give you an example, you can take look at this[1] source file in my posix32 
library, the way it handles `OutputDebugString` functions. The idea is 
basically to have a function (e.g. `winpthreads_create_event`) which calls 
either ANSI or Unicode version of `CreateEvent`, depending on whether code is 
running on NT or Win9x. This would also apply to functions such as 
`CreateMutex` or `CreateSemaphore`.

- Kirill Makurin

[1] 
https://github.com/maiddaisuki/posix32/blob/master/lib/posix32-core/src/debug.c

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to