Re: Futex Stack...

Liste des GroupesRevenir à c arch 
Sujet : Re: Futex Stack...
De : chris.m.thomasson.1 (at) *nospam* gmail.com (Chris M. Thomasson)
Groupes : comp.arch
Date : 09. Apr 2025, 07:07:11
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vt52qf$nrf$3@dont-email.me>
References : 1
User-Agent : Mozilla Thunderbird
On 3/25/2025 12:11 AM, Chris M. Thomasson wrote:
This is a little C++20 test using a futex to allow one to wait on a lock-free stack. The main stack logic is in struct ct_stack. Well, can you get to compile and run? Thanks... There is no need for DWCAS here. It uses just XCHG and CMPXCHG.
  My code:
______________________________________
[...]
To tidy things up a little, the flush_wait can look like this:
____________________
ct_node*
flush_wait()
{
     ct_node* head = m_head.exchange(nullptr, std::memory_order_acquire);
     while (! head || head == CT_WAIT)
     {
         // slow path...
         head = m_head.exchange(CT_WAIT, std::memory_order_acquire);
         if (! head || head == CT_WAIT)
         {
             m_head.wait(CT_WAIT, std::memory_order_relaxed);
         }
     }
     assert(head && head != CT_WAIT);
     return head;
}
____________________
Also, I made a spelling error wrt:
     unsigned long g_ct_work_alloations = 0;
     unsigned long g_ct_work_dealloations = 0;
grrrrr!

Date Sujet#  Auteur
25 Mar 25 * Futex Stack...3Chris M. Thomasson
28 Mar 25 +- Re: Futex Stack...1Chris M. Thomasson
9 Apr 25 `- Re: Futex Stack...1Chris M. Thomasson

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal