Deutsch English Français Italiano |
<v0v7rf$3lu04$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!feeds.phibee-telecom.net!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> Newsgroups: comp.lang.c++,comp.lang.c Subject: Re: Threads across programming languages Date: Wed, 1 May 2024 22:20:47 -0700 Organization: A noiseless patient Spider Lines: 62 Message-ID: <v0v7rf$3lu04$1@dont-email.me> References: <GIL-20240429161553@ram.dialup.fu-berlin.de> <v0ogum$1rc5n$1@dont-email.me> <v0ovvl$1ur12$4@dont-email.me> <v0p06i$1uq6q$5@dont-email.me> <v0shti$2vrco$2@raubtier-asyl.eternal-september.org> <v0spsh$31ds4$3@dont-email.me> <v0stic$325kv$3@raubtier-asyl.eternal-september.org> <v0svtn$32o8h$1@dont-email.me> <v0t091$32qj6$1@raubtier-asyl.eternal-september.org> <v0u90h$3c1r5$4@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 02 May 2024 07:20:47 +0200 (CEST) Injection-Info: dont-email.me; posting-host="ac84a891655eb9862e059597dab490b0"; logging-data="3864580"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19jEUclrHVJ+DeEXades5n//HorUVuPYDo=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:L8dFlASfGN52rxPgT5BsqHMuQUY= In-Reply-To: <v0u90h$3c1r5$4@dont-email.me> Content-Language: en-US Bytes: 3514 On 5/1/2024 1:34 PM, Lawrence D'Oliveiro wrote: > On Wed, 1 May 2024 10:59:16 +0200, Bonita Montero wrote: > >> Am 01.05.2024 um 10:53 schrieb Lawrence D'Oliveiro: >> >>> On Wed, 1 May 2024 10:13:03 +0200, Bonita Montero wrote: >>> >>>> Am 01.05.2024 um 09:10 schrieb Lawrence D'Oliveiro: >>>> >>>>> On Wed, 1 May 2024 06:54:13 +0200, Bonita Montero wrote: >>>>> >>>>>> Boost.ASIO does that all for you with a convenient interface. >>>>>> If enabled it even uses io_uring or the Windows' pendant. >>>>> >>>>> How many languages does it support? >>>> >>>> Just C++ ... >>> >>> Not much use, then. >> >> System-level programming is mostly made with C++. > > No, it is actually mostly C, with Rust making inroads these days. > > And you don’t have to be doing “system-level” programming to be needing > event-driven paradigms. > >>> But functions and classes are not first-class objects in C++, ... >> >> Of course, since C++11. > > No they aren’t. You cannot easily define a C++ function that returns a > general function or class as a result, just for example. > >>> You cannot define function factories and class factories, like you can >>> in Python. >> >> Python is nothing for me since it is extremely slow. > > Remember, we’re talking about maximizing I/O throughput here, so CPU is > not the bottleneck. It can be if your thread synchronization scheme is sub par. I have actually seen code where an IOCP completion thread locks a global mutex. Something like this pseudo-code: _________________ for (;;) { iocp_overlapped& p = GQCS(INFINITE); lock_mutex(global); // process event... unlock_mutex(global); } _________________ This is really BAD! It will create a rather massive bottleneck under times of heavy load... Also, it creates a nasty condition where things can become deadlocked if processing the overlapped completion calls into unknown user code to do some work. I have had to debug some others code like this before. Not exactly fun...