Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #84302

Re: A thread-queue

From "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Newsgroups comp.lang.c++
Subject Re: A thread-queue
Date 2022-05-27 18:24 -0700
Organization A noiseless patient Spider
Message-ID <t6rtla$3hc$1@dont-email.me> (permalink)
References (4 earlier) <t6po8o$h1t$1@dont-email.me> <t6q5sv$3q2$1@dont-email.me> <t6qg25$8j6$1@dont-email.me> <t6rf6l$em1$1@dont-email.me> <ULbkK.29059$IgSc.7575@fx45.iad>

Show all headers | View raw


On 5/27/2022 2:53 PM, Scott Lurndal wrote:
> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>> On 5/27/2022 5:26 AM, Bonita Montero wrote:
>>> On one side the situation Chis and others are afraid of doesn't
>>> actually happen. On the other side _copying_ the contents of a
>>> thread queue without consuming them isn't a requirement to a
>>> thread queue. So I removed the copy-constructor and left the
>>> move constructor which does everthing that's needed.
>>
>> Okay. However, it still makes me a bit nervous when I see code acquiring
>> more than one lock at a time. I have had some horror shows trying to
>> debug code written by others... One of the authors said, no need to
>> worry because the locks are recursive (yuck) without a care in the world
>> about lock ordering... Argh!
> 
> Back in the early 1980s we were updating the architecture
> of the Burroughs B3500/B4700/B4900 to support SMP and a larger
> physical memory space.   One of the features added to support
> SMP was hardware instructions providing capabilities similar to mutexes and posix
> condition variables.
> 
> To prevent deadlock, every lock has a 'canonical lock number' (CLN) that
> ranges from 1 to 9999.  The hardware will not allow the LOCK
> instruction to complete successfully if there has already
> been a lock acquired with a equal or higher CLN; the instruction
> will fault instead.   Likewise the UNLK instruction would fault
> of the lock was equal to the highest CLN stored in the hardware
> task data structure.
[...]

For some reason this makes me think of my pointer hash to mutex index 
thing I did a while back. It works quite well when the resulting array 
of indices is sorted and duplicates are removed. Locking order is solid 
and removing duplicates gets around using recursive locks.

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

A thread-queue Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-24 04:07 +0200
  Re: A thread-queue "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-05-25 13:58 -0700
    Re: A thread-queue Bo Persson <bo@bo-persson.se> - 2022-05-26 01:04 +0200
      Re: A thread-queue "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-05-25 20:58 -0700
      Re: A thread-queue Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-26 16:20 +0200
        Re: A thread-queue "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-05-26 22:40 -0700
          Re: A thread-queue Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-27 11:33 +0200
            Re: A thread-queue Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-27 14:26 +0200
              Re: A thread-queue "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-05-27 14:18 -0700
                Re: A thread-queue scott@slp53.sl.home (Scott Lurndal) - 2022-05-27 21:53 +0000
                Re: A thread-queue "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-05-27 15:43 -0700
                Re: A thread-queue scott@slp53.sl.home (Scott Lurndal) - 2022-05-28 14:51 +0000
                Re: A thread-queue "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-05-27 18:24 -0700
                Re: A thread-queue "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-05-27 18:26 -0700
                Re: A thread-queue scott@slp53.sl.home (Scott Lurndal) - 2022-05-28 14:56 +0000
                Re: A thread-queue "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-05-28 16:49 -0700
                Re: A thread-queue red floyd <no.spam.here@its.invalid> - 2022-05-28 17:16 -0700
                Re: A thread-queue "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-05-30 16:00 -0700
                Re: A thread-queue Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-28 07:16 +0200
    Re: A thread-queue Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-26 16:15 +0200

csiph-web