News for hackers. Stuff that matters.
Re:Threads Are a Bad Idea for Most Purposes (1995) [pdf] by PaulDavisThe1st on Tuesday January 28, 2020 @12:50PM (#22171906)
the thing that is missing (or was missing - not 100% of the current state of things right now) in nix land is the generalized concept of "waitForSomething" where "something" could include any* event/data that should/could wake a thread. kqueues help a bit, but I think it is still harder than it should be on *nix (even Linux) to write code whose semantics are "put this thread to sleep until anything happens".

If the thread is waiting on a specific set of objects (e.g. file descriptors, kqueues), then this can be done easily, but it's still not quite as simple as it has been under Windows (and by the way, IOCP is built on top of the underlying mechanism that makes this possible on Windows; they are not the mechanism itself)

Re:Threads Are a Bad Idea for Most Purposes (1995) [pdf] by theamk on Tuesday January 28, 2020 @02:55PM (#22173416)
Modern kernels support signalfd, timerfd and eventfd. With those things, it is possible to wait on almost anything.
Re:Threads Are a Bad Idea for Most Purposes (1995) [pdf] by zozbot234 on Tuesday January 28, 2020 @01:02PM (#22172113)
With io_uring this can be done on Linux as well.
Re:Threads Are a Bad Idea for Most Purposes (1995) [pdf] by StillBored on Tuesday January 28, 2020 @06:50PM (#22175510)
Not yet, read the LWN article and look at the todo list. There are a number of things still missing, and of course there are things like semaphores and generic eventing that still aren't part of io_uring.

io_uring is "different" and definitely has some advantages due to its shared ring buffer. but NT has a core/generic set of async completion/wait/etc functions that can be applied to basically the entire API surface.

Re:Threads Are a Bad Idea for Most Purposes (1995) [pdf] by gpderetta on Tuesday January 28, 2020 @08:42PM (#22176323)
I do not think you can wait on a critical section or a condition variable with WaitForMultipleEvents in windows. The same is true in linux. You can use select/poll/epoll on signalfd though.
Re:Threads Are a Bad Idea for Most Purposes (1995) [pdf] by StillBored on Tuesday January 28, 2020 @09:58PM (#22176835)
Does IORING_OP_POLL_ADD work with signalfd's (I don't really know without messing with it, how about IORING_OP_EPOLL_CTL?)?

I wouldn't assume it does until I've verified and read the code, I know last year at plumbers there was a fuss about the fact that a lot of operations which should have been working wernt. Frequently in odd ways, for example direct read worked but not direct write IIRC.