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


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

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-30 16:00 -0700
Organization A noiseless patient Spider
Message-ID <t73ib8$eab$1@dont-email.me> (permalink)
References (8 earlier) <ULbkK.29059$IgSc.7575@fx45.iad> <t6rtla$3hc$1@dont-email.me> <hKqkK.5192$ntj.713@fx15.iad> <t6ucf8$t6h$1@dont-email.me> <t6ue10$nrk$1@redfloyd.dont-email.me>

Show all headers | View raw


On 5/28/2022 5:16 PM, red floyd wrote:
> On 5/28/2022 4:49 PM, Chris M. Thomasson wrote:
>>
>> Agreed. The pointer hash in my multimutex has to be a good one. Any 
>> collisions would make two unrelated objects share the same index, 
>> which means they share the same mutex.
>>
> 
> For something as small as a pointer, wouldn't a CRC-32 be sufficient?
> 

I think so. It's basically a trade off between the performance of the 
hash and the penalty of having a collision where more than one thread is 
locking the same mapped mutex to more than one unrelated object.

Using the try_lock method to avoid deadlock, ala std::scoped_lock, 
works, but it can get into some live lock like scenarios under load. It 
has to resort to some exotic backoff techniques...

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