9

Having to do anything with the Win32 API makes me realize why basic and java are things that exist.

Comments
  • 2
    Then try a condition wait with timeout under Win32 (one line) and then under POSIX (completely retarded).
  • 3
    @Fast-Nop Try opening a file with Win32 in that case
  • 2
    @kescherRant I always use fopen() because it's in the C standard library.
  • 3
  • 2
    @kescherRant Only that timed conditions aren't. And waiting for multiple events aren't either.
  • 3
    @Fast-Nop
    pthread_cond_timedwait?
  • 3
    @SortOfTested Yep. The kicker is that this piece of shit takes an abolute target time instead of an interval. That's because of possible race conditions and changing system time.

    Now the race condition is moved out of pthread and instead in the application - specifically, between getting the current time and then calling the timed wait. But hey, that's not the problem of the POSIX scope anymore, so these assholes thought it would be OK.

    Also, you have to add the interval to the current time, and since a 64 bit whatever would be just too easy, you have to fuck around with the timespec struct, manually add the compnents and take care of overflow in the nanoseconds.

    Win32? You call the timed wait with an interval, just as any sane person would design it.
  • 1
    @SortOfTested And when I think of it, the whole pthread way of conditions is a shitshow, with the manual mutex, the predicate, and you even have to check the return value because it might return spuriously. In return for all that dickery, you can't even wait for multiple events at once.
  • 1
    @Fast-Nop
    I mean, you can, you just need to implement polling. Best place is right after importing daylight.js and sky.js, but before terra.js, wetness.js, or flora_fauna.js as they can be blocking.
  • 5
    @SortOfTested But in this world full of bloat and performance hogs, C programmers are like Asterix's village, with the C compiler as magic potion. ^^
  • 5
    @Fast-Nop
    Sometimes I forget how German you are ❤️

    Almost no one here has seen or read asterix
  • 0
    Anything win32 makes me nostalgic...sometimes you just need to get something lower level done....where other devs would quit get p/invoking...
  • 3
    @SortOfTested
    Asterix is pretty well-known in France and Canada too!
  • 2
    @Qwertronix
    I'd hope so, it's a French work 😋
  • 2
    @SortOfTested surprisingly well known here too (at least among my circles), I grew up reading Asterix as did my parents.
Add Comment