Sujet : Re: Python recompile
De : already5chosen (at) *nospam* yahoo.com (Michael S)
Groupes : comp.lang.cDate : 10. Mar 2025, 14:20:00
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250310152000.00004955@yahoo.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
User-Agent : Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
On Sun, 9 Mar 2025 21:48:31 -0000 (UTC)
Lawrence D'Oliveiro <
ldo@nz.invalid> wrote:
On Sun, 9 Mar 2025 11:28:07 +0200, Michael S wrote:
select/poll is the one way to do event-driven programming.
Yes it is.
There are other ways.
But you just said ...
In particular, under Windows you can simultaneously wait for
multiple objects with API that is called... Surprise!
WaitForMultipleObjects.
So, just select/poll under another name, then.
Similar to poll(), yes. Not so similar to super-ugly select(). I hope
that Unix people stopped using select in new programs two or more
decades ago.
But WaitForMultipleObjects can do things that poll can not, like
waiting on semaphore or on event or on thread (for completion, which
POSIX people, in their eternal fondness for idiotic names call 'join').
OTOH, WaitForMultipleObjects can not directly wait on sockets, because
in Win32 socket is not a "kernel object". So, in order to wait on
socket with WFMO one has to associate socket with event, which is done
by means of WSAEventSelect. Yes, the name of the API is bad. UNIX/POSIX
does not have monopoly on stupid names.
It really is “the one
way to do event-driven programming”. Only with the usual Windows
approach of added clunkiness.
As mentioned above, it depends on what you want to do. Sometimes UNIX
way is simpler, sometimes it's the other way around.
As to "the one way", you yourself mentioned substantially different way
in your post here several weeks ago - stackless co-routines. Even if
ends up the same under the hood, it appears quite different from
perspective of application programmer. Since we are in c.l.c I
should say that by now this way is not available in C.
Yet another different way is goroutines. They feel like threads but
lighter under the hood. I heard that similar thing was added to latests
Java. Since we are in c.l.c I should say that by now this way is
also not available in C. And, unlike in case of stackless co-routines,
I don't expect that it would be added to Standard C in foreseeable
future.
Yes, it does not work directly with anonymous files. But anonymous
file can be treated as a special version of named pipe and then it
does work.
I don’t think that makes sense. Otherwise the problem wouldn’t exist.
I don't know where was a catch. As a matter of fact, cygwin people found
solution, so the problem was soluble.