Sujet : Re: Futex Stack Test...
De : chris.m.thomasson.1 (at) *nospam* gmail.com (Chris M. Thomasson)
Groupes : comp.lang.c++Date : 19. Feb 2025, 21:06:38
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vp5dke$2dm82$2@dont-email.me>
References : 1 2 3
User-Agent : Mozilla Thunderbird
On 2/18/2025 11:13 AM, James Kuyper wrote:
On 2/18/25 02:01, Paavo Helde wrote:
On 18.02.2025 01:17, Chris M. Thomasson wrote:
...
Seamed to work fine, but compilation produced some warnings about the
CT_WAIT macro.
>
>
Build started at 08:55...
1>------ Build started: Project: ConsoleTest2022, Configuration: Release
x64 ------
1>futex-stack-test.cpp
1>C:\Test\ConsoleTestVS2022\ConsoleTest2022\futex-stack-test.cpp(55,25):
warning C4312: 'type cast': conversion from 'unsigned int' to 'ct_node
[...]
...
#define CT_WAIT ((ct_node*)0xDEADBEEF)
That should be a reinterpret_cast<>. Correcting that gets rid of all of
those messages.
Also, the following expressions should all use static_cast<>:
Ditto! Thanks James. I need to get off the C train when using C++! Grrr... Now, I have a little reservation about CT_WAIT. Let's say we allocate a work node that just happens to be equal to CT_WAIT! That would be bad. Humm... Should I allocate a special node, or put it on the stack or something, and denote it as CT_WAIT?
ct_work* head = (ct_work*)shared.m_stack_in.flush_wait();
...
ct_work* next = (ct_work*)head->m_next;
...
ct_work* head = (ct_work*)shared.m_stack_out.flush_wait();
...
ct_work* next = (ct_work*)head->m_next;
...
ct_work* head =
(ct_work*)shared.m_stack_in.m_head.load(std::memory_order_relaxed);
...
ct_work* next = (ct_work*)head->m_next