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


Groups > comp.lang.c++ > #113575 > unrolled thread

Run this under Windows and Linux

Started byBonita Montero <Bonita.Montero@gmail.com>
First post2023-10-30 08:12 +0100
Last post2023-11-05 15:30 +0000
Articles 20 on this page of 151 — 7 participants

Back to article view | Back to comp.lang.c++


Contents

  Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-30 08:12 +0100
    Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-30 13:08 -0700
      Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-31 13:25 +0100
        Re: Run this under Windows and Linux Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2023-10-31 17:37 +0000
        Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-31 13:59 -0700
          Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-01 13:00 +0100
            Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-01 19:24 +0100
              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-01 19:28 +0100
                Re: Run this under Windows and Linux scott@slp53.sl.home (Scott Lurndal) - 2023-11-01 19:04 +0000
                  Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-01 20:11 +0100
                    Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-01 13:02 -0700
                      Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 13:36 +0100
                        Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:13 -0700
                          Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 00:19 -0700
                            Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 10:13 +0100
                            Re: Run this under Windows and Linux scott@slp53.sl.home (Scott Lurndal) - 2023-11-04 15:53 +0000
                              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 16:58 +0100
                              Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 11:44 -0700
                                Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-09 01:05 -0800
                          Re: Run this under Windows and Linux scott@slp53.sl.home (Scott Lurndal) - 2023-11-04 16:03 +0000
                            Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 11:45 -0700
                              Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 11:48 -0700
                            Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 19:58 +0100
                              Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 12:14 -0700
              Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-01 13:01 -0700
                Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-02 07:10 +0100
              Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-01 20:50 +0000
                Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-01 14:05 -0700
                Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-01 14:07 -0700
              Re: Run this under Windows and Linux Michael S <already5chosen@yahoo.com> - 2023-11-03 16:04 +0200
                Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 15:24 +0100
                  Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:14 -0700
            Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-01 12:58 -0700
              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-02 07:10 +0100
                Re: Run this under Windows and Linux scott@slp53.sl.home (Scott Lurndal) - 2023-11-02 14:58 +0000
                  Re: Run this under Windows and Linux David Brown <david.brown@hesbynett.no> - 2023-11-02 16:34 +0100
                    Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-02 16:46 +0100
                    Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-02 13:12 -0700
                      Re: Run this under Windows and Linux David Brown <david.brown@hesbynett.no> - 2023-11-03 10:13 +0100
                        Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:16 -0700
                        Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-08 20:33 -0800
                  Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-02 16:44 +0100
                    Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-02 16:02 +0000
                      Re: Run this under Windows and Linux Michael S <already5chosen@yahoo.com> - 2023-11-03 16:10 +0200
                        Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 21:05 -0700
                          Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-05 04:23 +0000
                Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-02 15:37 +0000
                  Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-02 16:48 +0100
                    Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-02 16:00 +0000
                      Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-02 17:26 +0100
                        Re: Run this under Windows and Linux David Brown <david.brown@hesbynett.no> - 2023-11-03 10:15 +0100
                          Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 11:55 +0100
                            Re: Run this under Windows and Linux David Brown <david.brown@hesbynett.no> - 2023-11-03 14:41 +0100
                              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 15:22 +0100
                                Re: Run this under Windows and Linux David Brown <david.brown@hesbynett.no> - 2023-11-03 16:35 +0100
                                  Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 16:49 +0100
                                    Re: Run this under Windows and Linux David Brown <david.brown@hesbynett.no> - 2023-11-03 18:02 +0100
                                      Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 18:08 +0100
                                        Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-03 17:29 +0000
                                        Re: Run this under Windows and Linux scott@slp53.sl.home (Scott Lurndal) - 2023-11-03 18:52 +0000
                                        Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:21 -0700
                                        Re: Run this under Windows and Linux David Brown <david.brown@hesbynett.no> - 2023-11-04 17:22 +0100
                                          Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 17:35 +0100
                                            Re: Run this under Windows and Linux David Brown <david.brown@hesbynett.no> - 2023-11-04 17:56 +0100
                                              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 18:18 +0100
                                      Re: Run this under Windows and Linux scott@slp53.sl.home (Scott Lurndal) - 2023-11-03 18:51 +0000
                                      Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:20 -0700
                                    Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-03 17:28 +0000
                                      Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 18:30 +0100
                                        Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-03 18:03 +0000
                                          Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 19:07 +0100
                                            Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 19:08 +0100
                                              Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:26 -0700
                                        Re: Run this under Windows and Linux scott@slp53.sl.home (Scott Lurndal) - 2023-11-03 18:54 +0000
                                          Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 20:25 +0100
                                            Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-03 20:56 +0000
                                              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 10:15 +0100
                                                Re: Run this under Windows and Linux scott@slp53.sl.home (Scott Lurndal) - 2023-11-04 16:05 +0000
                                                  Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 17:35 +0100
                                                Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-04 18:44 +0000
                                    Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:19 -0700
                                      Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 10:16 +0100
                                      Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 10:25 +0100
                                        Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 12:42 -0700
                                          Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-05 05:33 +0100
                                          Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-05 05:35 +0100
                                            Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 12:11 -0800
                                              Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-05 22:54 +0000
                                                Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 18:49 -0800
                                                  Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-06 02:58 +0000
                            Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-03 15:32 +0000
                              Re: Run this under Windows and Linux David Brown <david.brown@hesbynett.no> - 2023-11-03 18:05 +0100
                            Re: Run this under Windows and Linux scott@slp53.sl.home (Scott Lurndal) - 2023-11-03 16:53 +0000
                              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 18:09 +0100
                                Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:25 -0700
                                  Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 10:17 +0100
                                    Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 12:44 -0700
                                      Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-05 05:36 +0100
                                        Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-05 17:25 +0000
                                          Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-05 18:55 +0100
                                            Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 12:12 -0800
                                              Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 12:18 -0800
                                                Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-05 22:55 +0000
                                                  Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 18:53 -0800
                                              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-06 04:44 +0100
                                                Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 20:10 -0800
                                                  Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-06 05:16 +0100
                                                    Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-08 20:44 -0800
                                                Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-06 04:22 +0000
                                                  Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-06 05:37 +0100
                                                    Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 21:01 -0800
                                                  Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 21:00 -0800
                                                    Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-06 09:36 +0100
                                                      Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-06 12:11 -0800
                                                        Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-06 23:52 +0100
                                                          Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-07 11:51 -0800
                                              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-06 05:15 +0100
                                                Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 21:02 -0800
                                                  Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 21:05 -0800
                                                    Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-06 09:37 +0100
                                                      Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-06 12:13 -0800
                                                        Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-06 23:53 +0100
                                                          Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-06 23:00 +0000
                                                            Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-07 05:36 +0100
                                                              Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-07 05:29 +0000
                                                                Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-07 09:38 +0100
                                                                  Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-07 11:53 -0800
                                                                    Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-09 05:49 +0100
                                                                      Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-08 20:52 -0800
                                                                        Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-09 05:54 +0100
                                                                          Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-08 20:57 -0800
                                                                  Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-08 20:45 -0800
                                            Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-05 20:53 +0000
                                              Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-06 12:13 -0800
                              Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:24 -0700
                            Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:18 -0700
                              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 10:18 +0100
                                Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 12:45 -0700
                      Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-02 13:18 -0700
          Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-01 13:21 +0100
            Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-01 12:59 -0700
              Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 00:01 -0700
              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 10:19 +0100
                Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 10:53 +0100
                Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 12:51 -0700
                  Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 12:53 -0700
                    Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 12:54 -0700
                      Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 12:15 -0800
    Re: Run this under Windows and Linux Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2023-11-03 21:18 +0000
      Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 10:29 +0100
        Re: Run this under Windows and Linux Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2023-11-05 15:30 +0000

Page 4 of 8 — ← Prev page 1 2 3 [4] 5 6 7 8  Next page →


#117539

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2023-11-03 15:21 -0700
Message-ID<ui3rou$2vc30$8@dont-email.me>
In reply to#117519
On 11/3/2023 10:08 AM, Bonita Montero wrote:
> Am 03.11.2023 um 18:02 schrieb David Brown:
> 
>> Please read <https://en.cppreference.com/w/cpp/thread/mutex/unlock>. 
>> Note the sentence "The mutex must be locked by the current thread of 
>> execution, otherwise, the behavior is undefined."
> 
> Maybe, but I'm talking about how mutexes usually work internally.
> 
> 
>> Using a semaphore as a lock is not recommended because a semaphore 
>> does not make a good lock.  A main reason for that is that it has no 
>> concept of ownership. ...
> 
> Mutexes also usually have no notion of ownership.
> 

The Art of Trolling, 123, all is me...

[toc] | [prev] | [next] | [standalone]


#117559

FromDavid Brown <david.brown@hesbynett.no>
Date2023-11-04 17:22 +0100
Message-ID<ui5r4b$3eh87$1@dont-email.me>
In reply to#117519
On 03/11/2023 18:08, Bonita Montero wrote:
> Am 03.11.2023 um 18:02 schrieb David Brown:
> 
>> Please read <https://en.cppreference.com/w/cpp/thread/mutex/unlock>. 
>> Note the sentence "The mutex must be locked by the current thread of 
>> execution, otherwise, the behavior is undefined."
> 
> Maybe, but I'm talking about how mutexes usually work internally.
> 

I think, from this thread, it is clear that you have no idea how mutexes 
are used.  I therefore assume you have no idea how they work internally. 
  And I am entirely confident that your idea of "usually" is limited to 
one single OS.

> 
>> Using a semaphore as a lock is not recommended because a semaphore 
>> does not make a good lock.  A main reason for that is that it has no 
>> concept of ownership. ...
> 
> Mutexes also usually have no notion of ownership.
> 

I stand corrected.  Your idea of "usually" is limited to no OS in existence.

[toc] | [prev] | [next] | [standalone]


#117560

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-11-04 17:35 +0100
Message-ID<ui5rrt$3el49$1@dont-email.me>
In reply to#117559
Am 04.11.2023 um 17:22 schrieb David Brown:

> I think, from this thread, it is clear that you have no idea how mutexes 
> are used. ...

I use them every day and I've developed my own reader's-writer-lock.

> I stand corrected.  Your idea of "usually" is limited to no OS in 
> existence.

A non-recurive mutex doensn't need to know which thread is the
owner, but just that there's an owner.

[toc] | [prev] | [next] | [standalone]


#117562

FromDavid Brown <david.brown@hesbynett.no>
Date2023-11-04 17:56 +0100
Message-ID<ui5t30$3eqgc$1@dont-email.me>
In reply to#117560
On 04/11/2023 17:35, Bonita Montero wrote:
> Am 04.11.2023 um 17:22 schrieb David Brown:
> 
>> I think, from this thread, it is clear that you have no idea how 
>> mutexes are used. ...
> 
> I use them every day and I've developed my own reader's-writer-lock.
> 

Do you do all your work relying on luck?

>> I stand corrected.  Your idea of "usually" is limited to no OS in 
>> existence.
> 
> A non-recurive mutex doensn't need to know which thread is the
> owner, but just that there's an owner.
> 

No, it needs to know the owner - because only the owner is allowed to 
release the lock.

I suppose you could make a half-arsed mutex implementation that relies 
on programmers never making mistakes, and just let the nasal demons fly 
when people like you can't read and follow specifications.

And even if you have such a poor mutex implementation, conceptually 
there is always an owner when the lock is taken - that's the point of 
the thing.

[toc] | [prev] | [next] | [standalone]


#117563

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-11-04 18:18 +0100
Message-ID<ui5udh$3f4m5$1@dont-email.me>
In reply to#117562
Am 04.11.2023 um 17:56 schrieb David Brown:


> No, it needs to know the owner - because only the owner is allowed to 
> release the lock.

This is a superfluous check that does not determine function.

> I suppose you could make a half-arsed mutex implementation that relies 
> on programmers never making mistakes, and just let the nasal demons fly 
> when people like you can't read and follow specifications.

It may be possible to release a mutex from another thread, but as no
one does this this check doesn't make sense. That that much unlikely
that that happens that it doesn't make sense as a debugging aid, even
more in C++, where you can't forget unlocking inside the same thread
if you use a unique_lock<> or lock_guard<>.

[toc] | [prev] | [next] | [standalone]


#117527

Fromscott@slp53.sl.home (Scott Lurndal)
Date2023-11-03 18:51 +0000
Message-ID<7jb1N.177700$sxoa.38730@fx13.iad>
In reply to#117517
David Brown <david.brown@hesbynett.no> writes:
>On 03/11/2023 16:49, Bonita Montero wrote:
>> Am 03.11.2023 um 16:35 schrieb David Brown:
>> 
>>> And using the definitions held by most people involved (including the 
>>> C++ standard library, the Windows API, and AFAIK POSIX), mutexes have 
>>> ownership and semaphores do not. ...
>> 
>> Mutexes only have ownership if they're recursive. Otherwise you
>> can easily unlock a mutex which was locked in another thread.
>> 
>
>Please read <https://en.cppreference.com/w/cpp/thread/mutex/unlock>. 
>Note the sentence "The mutex must be locked by the current thread of 
>execution, otherwise, the behavior is undefined."
>
>Please read the C++ standards, section [thread.mutex.requirements.mutex] 
>and note that for "unlock()", there is the sentence "Preconditions: The 
>calling thread owns the mutex."
>

And  read the POSIX standard as well.

https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_lock.html

>Please learn what "undefined behaviour" means, and what "preconditions" 
>mean.
>
>Then come back and apologise.
>
>>> A semaphore is not a lock, ...
>> 
>> It can be used as a lock although it is not recommended because
>> a semaphore is usually a pure kernel facility.
>> 
>
>Using a semaphore as a lock is not recommended because a semaphore does 
>not make a good lock.  A main reason for that is that it has no concept 
>of ownership.  /All/ locking and inter-thread signalling mechanisms rely 
>on kernel facilities, because they need to be able to sleep, and to wake 
>sleeping threads.
>
>

[toc] | [prev] | [next] | [standalone]


#117538

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2023-11-03 15:20 -0700
Message-ID<ui3rnv$2vc30$7@dont-email.me>
In reply to#117517
On 11/3/2023 10:02 AM, David Brown wrote:
> On 03/11/2023 16:49, Bonita Montero wrote:
>> Am 03.11.2023 um 16:35 schrieb David Brown:
>>
>>> And using the definitions held by most people involved (including the 
>>> C++ standard library, the Windows API, and AFAIK POSIX), mutexes have 
>>> ownership and semaphores do not. ...
>>
>> Mutexes only have ownership if they're recursive. Otherwise you
>> can easily unlock a mutex which was locked in another thread.
>>
> 
> Please read <https://en.cppreference.com/w/cpp/thread/mutex/unlock>. 
> Note the sentence "The mutex must be locked by the current thread of 
> execution, otherwise, the behavior is undefined."
> 
> Please read the C++ standards, section [thread.mutex.requirements.mutex] 
> and note that for "unlock()", there is the sentence "Preconditions: The 
> calling thread owns the mutex."
> 
> Please learn what "undefined behaviour" means, and what "preconditions" 
> mean.
> 
> Then come back and apologise.

If I wait for that day, well, I will most likely be dead.


> 
>>> A semaphore is not a lock, ...
>>
>> It can be used as a lock although it is not recommended because
>> a semaphore is usually a pure kernel facility.
>>
> 
> Using a semaphore as a lock is not recommended because a semaphore does 
> not make a good lock.  A main reason for that is that it has no concept 
> of ownership.  /All/ locking and inter-thread signalling mechanisms rely 
> on kernel facilities, because they need to be able to sleep, and to wake 
> sleeping threads.
> 
> 

[toc] | [prev] | [next] | [standalone]


#117521

FromKaz Kylheku <864-117-4973@kylheku.com>
Date2023-11-03 17:28 +0000
Message-ID<20231103102128.731@kylheku.com>
In reply to#117515
On 2023-11-03, Bonita Montero <Bonita.Montero@gmail.com> wrote:
> Am 03.11.2023 um 16:35 schrieb David Brown:
>
>> And using the definitions held by most people involved (including the 
>> C++ standard library, the Windows API, and AFAIK POSIX), mutexes have 
>> ownership and semaphores do not. ...
>
> Mutexes only have ownership if they're recursive. Otherwise you
> can easily unlock a mutex which was locked in another thread.

That depends entirely on which kind of mutex on what platform.

- POSIX mutexes make that either an error, or undefined behavior,
  depending on the mutex attributes.

- MSDN says this about critical sections: "If a thread calls
  LeaveCriticalSection when it does not have ownership of the specified
  critical section object, an error occurs that may cause another thread
  using EnterCriticalSection to wait indefinitely."

- MSDN, again, about Win32 mutex objects: "The ReleaseMutex function
  fails if the calling thread does not own the mutex object."

- ISO C (since C11) mtx_unlock: undefined behavior if mutex is not
  locked by the calling thread.

- C++ std::mutex::unlock: ditto.

At this point, I'm already well into stuff I don't give a shit about,
to look for more. I don't care if ScrotelyOS developed in Ruritania
between 1973 and 1981 had "mutexes" that had up to three owners.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

[toc] | [prev] | [next] | [standalone]


#117523

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-11-03 18:30 +0100
Message-ID<ui3aob$2sa5j$1@dont-email.me>
In reply to#117521
Am 03.11.2023 um 18:28 schrieb Kaz Kylheku:

> That depends entirely on which kind of mutex on what platform.
> 
> - POSIX mutexes make that either an error, or undefined behavior,
>    depending on the mutex attributes.
> 
> - MSDN says this about critical sections: "If a thread calls
>    LeaveCriticalSection when it does not have ownership of the specified
>    critical section object, an error occurs that may cause another thread
>    using EnterCriticalSection to wait indefinitely."
> 
> - MSDN, again, about Win32 mutex objects: "The ReleaseMutex function
>    fails if the calling thread does not own the mutex object."
> 
> - ISO C (since C11) mtx_unlock: undefined behavior if mutex is not
>    locked by the calling thread.
> 
> - C++ std::mutex::unlock: ditto.
> 
> At this point, I'm already well into stuff I don't give a shit about,
> to look for more. I don't care if ScrotelyOS developed in Ruritania
> between 1973 and 1981 had "mutexes" that had up to three owners.

The discussed benaphore allows this.

[toc] | [prev] | [next] | [standalone]


#117524

FromKaz Kylheku <864-117-4973@kylheku.com>
Date2023-11-03 18:03 +0000
Message-ID<20231103105439.435@kylheku.com>
In reply to#117523
On 2023-11-03, Bonita Montero <Bonita.Montero@gmail.com> wrote:
> Am 03.11.2023 um 18:28 schrieb Kaz Kylheku:
>
>> That depends entirely on which kind of mutex on what platform.
>> 
>> - POSIX mutexes make that either an error, or undefined behavior,
>>    depending on the mutex attributes.
>> 
>> - MSDN says this about critical sections: "If a thread calls
>>    LeaveCriticalSection when it does not have ownership of the specified
>>    critical section object, an error occurs that may cause another thread
>>    using EnterCriticalSection to wait indefinitely."
>> 
>> - MSDN, again, about Win32 mutex objects: "The ReleaseMutex function
>>    fails if the calling thread does not own the mutex object."
>> 
>> - ISO C (since C11) mtx_unlock: undefined behavior if mutex is not
>>    locked by the calling thread.
>> 
>> - C++ std::mutex::unlock: ditto.
>> 
>> At this point, I'm already well into stuff I don't give a shit about,
>> to look for more. I don't care if ScrotelyOS developed in Ruritania
>> between 1973 and 1981 had "mutexes" that had up to three owners.
>
> The discussed benaphore allows this.

That's a kind of semaphore, and its name reflects that.

Benoit Schillings introduced this word as an optimization that is
for certain inefficient semaphore implementations:

https://www.haiku-os.org/legacy-docs/benewsletter/Issue1-26.html#Engineering1-26

He recommends this:

  void acquire_benaphore()
  {
     long previous_value;
     previous_value = atomic_add (&benaphore_atom, 1);

     if (previous_value > 0)
	acquire_sem(benaphore_sem);
  }

Firstly, this is not a mutex but a semaphore. Secondly, it only makes
sense if acquire_sem is somehow expensive (like a trap to the kernel).

The reason is that acquire_sem already looks like acquire_benaphore:

  void acquire_sem(semaphore *s)
  {
     long prev = atomic_add(&s->counter);

     if (prev > 0) {
       // suspend caller somehow
     }

     // ...

  }


-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

[toc] | [prev] | [next] | [standalone]


#117525

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-11-03 19:07 +0100
Message-ID<ui3csi$2sm3u$1@dont-email.me>
In reply to#117524
Am 03.11.2023 um 19:03 schrieb Kaz Kylheku:
> On 2023-11-03, Bonita Montero <Bonita.Montero@gmail.com> wrote:

>> Am 03.11.2023 um 18:28 schrieb Kaz Kylheku:

>> The discussed benaphore allows this.

> That's a kind of semaphore, and its name reflects that.

It's a mutex, look at the code.
And look at the discussion on stack overflow about that:
https://stackoverflow.com/questions/1635416/are-benaphores-worth-implementing-on-modern-oss

[toc] | [prev] | [next] | [standalone]


#117526

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-11-03 19:08 +0100
Message-ID<ui3cvg$2sngu$1@dont-email.me>
In reply to#117525
Am 03.11.2023 um 19:07 schrieb Bonita Montero:

> It's a mutex, look at the code.
> And look at the discussion on stack overflow about that:
> https://stackoverflow.com/questions/1635416/are-benaphores-worth-implementing-on-modern-oss

And this article also refers to it as a mutex:
https://preshing.com/20120226/roll-your-own-lightweight-mutex/

[toc] | [prev] | [next] | [standalone]


#117542

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2023-11-03 15:26 -0700
Message-ID<ui3s3c$2vc30$11@dont-email.me>
In reply to#117526
On 11/3/2023 11:08 AM, Bonita Montero wrote:
> Am 03.11.2023 um 19:07 schrieb Bonita Montero:
> 
>> It's a mutex, look at the code.
>> And look at the discussion on stack overflow about that:
>> https://stackoverflow.com/questions/1635416/are-benaphores-worth-implementing-on-modern-oss
> 
> And this article also refers to it as a mutex:
> https://preshing.com/20120226/roll-your-own-lightweight-mutex/
> 

Oh my god...

[toc] | [prev] | [next] | [standalone]


#117529

Fromscott@slp53.sl.home (Scott Lurndal)
Date2023-11-03 18:54 +0000
Message-ID<zlb1N.177702$sxoa.164234@fx13.iad>
In reply to#117523
Bonita Montero <Bonita.Montero@gmail.com> writes:
>Am 03.11.2023 um 18:28 schrieb Kaz Kylheku:
>
>> That depends entirely on which kind of mutex on what platform.
>> 
>> - POSIX mutexes make that either an error, or undefined behavior,
>>    depending on the mutex attributes.
>> 
>> - MSDN says this about critical sections: "If a thread calls
>>    LeaveCriticalSection when it does not have ownership of the specified
>>    critical section object, an error occurs that may cause another thread
>>    using EnterCriticalSection to wait indefinitely."
>> 
>> - MSDN, again, about Win32 mutex objects: "The ReleaseMutex function
>>    fails if the calling thread does not own the mutex object."
>> 
>> - ISO C (since C11) mtx_unlock: undefined behavior if mutex is not
>>    locked by the calling thread.
>> 
>> - C++ std::mutex::unlock: ditto.
>> 
>> At this point, I'm already well into stuff I don't give a shit about,
>> to look for more. I don't care if ScrotelyOS developed in Ruritania
>> between 1973 and 1981 had "mutexes" that had up to three owners.
>
>The discussed benaphore allows this.

And which operating system offers this soi disant 'benaphore' as a
synchronization mechanism?

[toc] | [prev] | [next] | [standalone]


#117530

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-11-03 20:25 +0100
Message-ID<ui3hec$2th64$1@dont-email.me>
In reply to#117529
Am 03.11.2023 um 19:54 schrieb Scott Lurndal:

> And which operating system offers this soi disant 'benaphore' as a
> synchronization mechanism?

Non-recursive mutexes mostly base on the same mechanisms since
an atomic add doesn't need looping.

[toc] | [prev] | [next] | [standalone]


#117531

FromKaz Kylheku <864-117-4973@kylheku.com>
Date2023-11-03 20:56 +0000
Message-ID<20231103135319.1@kylheku.com>
In reply to#117530
On 2023-11-03, Bonita Montero <Bonita.Montero@gmail.com> wrote:
> Am 03.11.2023 um 19:54 schrieb Scott Lurndal:
>
>> And which operating system offers this soi disant 'benaphore' as a
>> synchronization mechanism?
>
> Non-recursive mutexes mostly base on the same mechanisms since
> an atomic add doesn't need looping.

An atomic counter, featuring a wait when the value is in a certain
range, is known as semaphore.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

[toc] | [prev] | [next] | [standalone]


#117547

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-11-04 10:15 +0100
Message-ID<ui522k$3a606$2@dont-email.me>
In reply to#117531
Am 03.11.2023 um 21:56 schrieb Kaz Kylheku:

> An atomic counter, featuring a wait when the value is in a certain
> range, is known as semaphore.

An atomic counter alone isn't sufficient for a semaphore because
there's no way to sleep or to be awakened with that.

[toc] | [prev] | [next] | [standalone]


#117558

Fromscott@slp53.sl.home (Scott Lurndal)
Date2023-11-04 16:05 +0000
Message-ID<fZt1N.211578$0UVe.68947@fx17.iad>
In reply to#117547
Bonita Montero <Bonita.Montero@gmail.com> writes:
>Am 03.11.2023 um 21:56 schrieb Kaz Kylheku:
>
>> An atomic counter, featuring a wait when the value is in a certain
>> range, is known as semaphore.
>
>An atomic counter alone isn't sufficient for a semaphore because
>there's no way to sleep or to be awakened with that.

Sure there is.  It's even obvious.

[toc] | [prev] | [next] | [standalone]


#117561

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-11-04 17:35 +0100
Message-ID<ui5rsv$3el49$2@dont-email.me>
In reply to#117558
Am 04.11.2023 um 17:05 schrieb Scott Lurndal:
> Bonita Montero <Bonita.Montero@gmail.com> writes:
>> Am 03.11.2023 um 21:56 schrieb Kaz Kylheku:
>>
>>> An atomic counter, featuring a wait when the value is in a certain
>>> range, is known as semaphore.
>>
>> An atomic counter alone isn't sufficient for a semaphore because
>> there's no way to sleep or to be awakened with that.
> 
> Sure there is.  It's even obvious.

Not for Kaz.

[toc] | [prev] | [next] | [standalone]


#117565

FromKaz Kylheku <864-117-4973@kylheku.com>
Date2023-11-04 18:44 +0000
Message-ID<20231104114042.123@kylheku.com>
In reply to#117547
On 2023-11-04, Bonita Montero <Bonita.Montero@gmail.com> wrote:
> Am 03.11.2023 um 21:56 schrieb Kaz Kylheku:
>
>> An atomic counter, featuring a wait when the value is in a certain
>> range, is known as semaphore.
>
> An atomic counter alone isn't sufficient for a semaphore because
> there's no way to sleep or to be awakened with that.

You're not successfully making it appear as if I said that.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

[toc] | [prev] | [next] | [standalone]


Page 4 of 8 — ← Prev page 1 2 3 [4] 5 6 7 8  Next page →

Back to top | Article view | comp.lang.c++


csiph-web