On Sunday, March 3, 2019 at 1:28:03 AM UTC-8, Chris M. Thomasson wrote:
>
> On Tuesday, February 26, 2019 at 12:16:24 AM UTC-8, Dmitry Vyukov wrote:
>>
>> On Wed, Feb 20, 2019 at 1:31 AM Chris M. Thomasson <cri...@charter.net> 
>> wrote: 
>> [...]
>> We can try with some new change :) 
>>
>
> Just as a first start, I changed m_count to unsigned long, and is 
> "integrated" with lock and unlock, and still has no loops, just a first 
> exploratory experiment. Here is the code:
>
> It still only uses fetch_add. Humm, not sure what to make of it. Also, I 
> am pissed that fetch_or goes to CMPXCHG loop on x86.
>
> _________________________________
> // Chris M. Thomassons Experimental Read/Write Mutex
> [...]
>
>     // WRITE, more hefty
>     void wrlock()
>     {
>         unsigned long wrcount = m_count.fetch_add(WRITE, 
> std::memory_order_acquire);
>
>         if ((wrcount & WRITE_MASK) > 0)
>         {
>             m_wrmtx.dec();
>         }
>
^^^^^^^^^^^^^^^^^^

Still thinking about getting rid of the above mutex, and directly 
integrating the waiting into a single semaphore without using loops. 
Humm... I would have to change the way readers can unlock writers and vise 
versa. It is a bit challenging to do without loops.

 

>
>         unsigned long count = m_count.fetch_add(WRITE_BIT, 
> std::memory_order_acquire);
>

[...]

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Scalable Synchronization Algorithms" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to lock-free+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/lock-free/6da39ca7-7b5c-4709-a569-faf3f00853d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to