Path: csiph.com!weretis.net!feeder8.news.weretis.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c++ Subject: Re: Multithreaded Programming : Always use spinlocks for performance? Date: Sun, 24 Jul 2022 11:38:51 -0700 Organization: None to speak of Lines: 20 Message-ID: <87v8rmz77o.fsf@nosuchdomain.example.com> References: <8d6a4871-4c9c-405a-81ad-374a6899cc94n@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: reader01.eternal-september.org; posting-host="82df9bf89012dbb95e5b496a6f66eb7c"; logging-data="801725"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//pZzqZrCVx9EUucLWpCCU" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:10uaTxbism0tYPE/9jFBKf9q/58= sha1:HuWYJn4ek44+8WadJGPIomr8fgk= Xref: csiph.com comp.lang.c++:85591 Frederick Virchanza Gotham writes: [...] > void Entry_Point_For_Worker_Thread(void) > { > for (;;) > { > while ( false == g_should_process_data ); // <-- This is what I mean when I say 'spin lock' > > /* Process data */ > } > } [...] Not relevant to your question, but why would you write `false == g_should_process_data` rather than `! should_process_data`? -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips void Void(void) { Void(); } /* The recursive call of the void */