Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #89026
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: timed_mutex -- but it acquires the lock |
| Date | 2023-02-07 12:22 -0800 |
| Organization | A noiseless patient Spider |
| Message-ID | <trubts$3rom8$6@dont-email.me> (permalink) |
| References | <64e83b9b-70d8-4273-9423-f7e7f96b453en@googlegroups.com> <k4el2qF5ktqU1@mid.individual.net> |
On 2/7/2023 1:48 AM, Bo Persson wrote: > On 2023-02-07 at 10:25, Frederick Virchanza Gotham wrote: >> >> Since C++11, we already have "std::timed_mutex". It will try to >> acquire the lock for N seconds and fail, and you can handle the failure. >> >> I want to make another kind of timed mutex, called something like >> "std::timed_rescuable_mutex", but the difference will be that when you >> invoke "try_lock_for", it will wait for N seconds, and then if the >> mutex is still locked, it will kill the thread that locked it, and >> then unlock the mutex. >> > > Killing a thread at a random position seems to be a perfect way to enter > an unspecified state for the program. It's horrible. Well, I had to deal with robust mutexes many moons ago. If a processed dies while holding a mutex, we can try to recover and repair its state: https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutexattr_setrobust.html Windows even has WAIT_ABANDONED. Have fun! It can be done, but is it not exactly, fun... > > What if that thread is halfway through reallocating a vector? > Yikes!
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
timed_mutex -- but it acquires the lock Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2023-02-07 01:25 -0800
Re: timed_mutex -- but it acquires the lock Muttley@dastardlyhq.com - 2023-02-07 09:40 +0000
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-07 12:12 -0800
Re: timed_mutex -- but it acquires the lock Bo Persson <bo@bo-persson.se> - 2023-02-07 10:48 +0100
Re: timed_mutex -- but it acquires the lock Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2023-02-07 05:46 -0800
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-07 12:14 -0800
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-07 12:22 -0800
Re: timed_mutex -- but it acquires the lock Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2023-02-07 14:17 -0800
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-07 14:24 -0800
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-07 14:49 -0800
Re: timed_mutex -- but it acquires the lock Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2023-02-07 14:51 -0800
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-07 14:53 -0800
Re: timed_mutex -- but it acquires the lock scott@slp53.sl.home (Scott Lurndal) - 2023-02-07 23:01 +0000
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-07 16:06 -0800
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-07 14:28 -0800
Re: timed_mutex -- but it acquires the lock Paavo Helde <eesnimi@osa.pri.ee> - 2023-02-07 12:23 +0200
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-07 14:53 -0800
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-07 16:08 -0800
Re: timed_mutex -- but it acquires the lock Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2023-02-08 10:37 -0800
Re: timed_mutex -- but it acquires the lock Paavo Helde <eesnimi@osa.pri.ee> - 2023-02-08 20:52 +0200
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-08 12:37 -0800
Re: timed_mutex -- but it acquires the lock Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2023-02-08 15:14 -0800
Re: timed_mutex -- but it acquires the lock Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2023-02-08 17:33 -0800
Re: timed_mutex -- but it acquires the lock Öö Tiib <ootiib@hot.ee> - 2023-02-08 17:45 -0800
Re: timed_mutex -- but it acquires the lock David Brown <david.brown@hesbynett.no> - 2023-02-09 09:23 +0100
Re: timed_mutex -- but it acquires the lock Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2023-02-09 01:24 -0800
Re: timed_mutex -- but it acquires the lock Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2023-02-09 02:02 -0800
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-09 15:10 -0800
Re: timed_mutex -- but it acquires the lock Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2023-02-10 08:06 -0800
Re: timed_mutex -- but it acquires the lock David Brown <david.brown@hesbynett.no> - 2023-02-10 17:30 +0100
Re: timed_mutex -- but it acquires the lock scott@slp53.sl.home (Scott Lurndal) - 2023-02-10 17:02 +0000
Re: timed_mutex -- but it acquires the lock Richard Damon <Richard@Damon-Family.org> - 2023-02-10 20:02 -0500
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-17 12:58 -0800
Re: timed_mutex -- but it acquires the lock Paavo Helde <eesnimi@osa.pri.ee> - 2023-02-10 20:57 +0200
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-09 04:02 -0800
Re: timed_mutex -- but it acquires the lock Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2023-02-09 04:16 -0800
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-09 04:28 -0800
Re: timed_mutex -- but it acquires the lock Paavo Helde <eesnimi@osa.pri.ee> - 2023-02-09 14:36 +0200
Re: timed_mutex -- but it acquires the lock Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> - 2023-02-09 08:34 -0800
Re: timed_mutex -- but it acquires the lock David Brown <david.brown@hesbynett.no> - 2023-02-09 20:25 +0100
Re: timed_mutex -- but it acquires the lock scott@slp53.sl.home (Scott Lurndal) - 2023-02-09 19:39 +0000
Re: timed_mutex -- but it acquires the lock Paavo Helde <eesnimi@osa.pri.ee> - 2023-02-09 23:24 +0200
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-09 14:08 -0800
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-09 15:07 -0800
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-08 12:36 -0800
Re: timed_mutex -- but it acquires the lock Paavo Helde <eesnimi@osa.pri.ee> - 2023-02-09 09:14 +0200
Re: timed_mutex -- but it acquires the lock "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-02-09 14:17 -0800
csiph-web