Deutsch   English   Français   Italiano  
<20241208013025.902@kylheku.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.lang.c
Subject: Re: best approach for multithreading (?)
Date: Sun, 8 Dec 2024 09:31:45 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <20241208013025.902@kylheku.com>
References: <ddd3a0b59c95b5752b66f46348c96a6f8279d518@i2pn2.org>
 <slrnvkousf.2d4d7.candycanearter07@candydeb.host.invalid>
 <vii0ao$2jdsb$1@dont-email.me> <20241201074928.161@kylheku.com>
 <viipr8$2qq41$4@dont-email.me> <20241203094647.518@kylheku.com>
 <vitfc3$1so4u$1@dont-email.me> <20241205191339.256@kylheku.com>
 <3mF4P.64$pAh5.41@fx06.iad> <vj0ln4$2se98$1@dont-email.me>
 <20241207044414.446@kylheku.com> <vj37o7$3eaf4$4@dont-email.me>
Injection-Date: Sun, 08 Dec 2024 10:31:46 +0100 (CET)
Injection-Info: dont-email.me; posting-host="a7f5c249dbe01658af48224af11a9e74";
	logging-data="3909566"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/qvv6nTeZ4XJmYlxsmCxMRiia95Hgdqlw="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:q9lGjdFRM6TzoB7BONpDaN0/gfo=
Bytes: 2628

On 2024-12-08, Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
> On 12/7/2024 7:49 PM, Kaz Kylheku wrote:
>> On 2024-12-07, James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
>>> My words above not-withstanding, I am not in any sense an expert on any
>>> kind of threading, nor of Windows. What does POSIX require of threads
>>> with regards to signals?
>> 
>> Off the top of my head, the highlights:
>> 
>> - threads have their own signal masks, inherited from the creator which
>>    calls pthtead_create.
>> - signal masks can be manipulated so that a given signal will be
>>    handled in the context of a desired thread.
>> - sigwait (and several other functions) can be used by a thread to
>>    wait for one or more signals, allowing signals to be process
>>    synchronously, somewhat like message passing.
>> 
>
> Semaphores are sig safe, so to speak. It's been a while:
>
> https://www.man7.org/linux/man-pages/man3/sem_post.3.html
>
> should be sig safe? Or, am I wrong here Kaz?

Yes; just not sem_wait. The obvious idea there is that a signal handler
is like an interrupt service top half, and those must be able to bang
semaphores, to wake up something waiting in the bottom half code.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca