Deutsch English Français Italiano |
<vj5e7k$gift$4@paganini.bofh.team> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!2.eu.feeder.erje.net!feeder.erje.net!newsfeed.bofh.team!paganini.bofh.team!not-for-mail From: antispam@fricas.org (Waldek Hebisch) Newsgroups: comp.lang.c Subject: Re: best approach for multithreading (?) Date: Mon, 9 Dec 2024 00:39:18 -0000 (UTC) Organization: To protect and to server Message-ID: <vj5e7k$gift$4@paganini.bofh.team> 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> Injection-Date: Mon, 9 Dec 2024 00:39:18 -0000 (UTC) Injection-Info: paganini.bofh.team; logging-data="543229"; posting-host="WwiNTD3IIceGeoS5hCc4+A.user.paganini.bofh.team"; mail-complaints-to="usenet@bofh.team"; posting-account="9dIQLXBM7WM9KzA+yjdR4A"; User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64)) X-Notice: Filtered by postfilter v. 0.9.3 Bytes: 3086 Lines: 39 Kaz Kylheku <643-408-1753@kylheku.com> wrote: > On 2024-12-07, James Kuyper <jameskuyper@alumni.caltech.edu> wrote: >> On 12/6/24 11:10, Scott Lurndal wrote: >>> Kaz Kylheku <643-408-1753@kylheku.com> writes: >>>> On 2024-12-06, James Kuyper <jameskuyper@alumni.caltech.edu> wrote: >> ... >>>>> C <threads.h> can be implemented as a thin wrapper over POSIX threads. >>>>> The waste is relatively negligible. The differences, were intended to >>>>> allow <threads.h> to also be implemented on non-POSIX systems as >>>>> wrappers for whatever the native threading system was. >>>> >>>> Generally speaking, you can have a function called pthread_create on >>>> non-POSIX systems, and a header <pthread.h>. >>> >>> There are certain requirements of a posix threads implementation that >>> might be impossible for a non-POSIX system to implement efficiently; >>> windows, for example, doesn't support signals. >> >> 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. Hmm, as long as there is no way to generate signals the above can be implemented as a no-op or close (say possibly storing mask somewhere so that application can get it back). Of course, it would be harder if Windows has signals or if POSIX requires ability to generate signals. -- Waldek Hebisch