Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #81351
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | condvar-implementation |
| Date | 2021-09-20 20:44 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <siakpt$oha$1@dont-email.me> (permalink) |
A long time ago I found a page describing different approaches to imple- ment a condvar under Windows, but this would apply to any operating-sys- tem having parallelism through supplying semaphores and being designed for CPUs with atomic operations. I just wrote a special Java-like monitor-object for Win32 and __unix__. One speciality with my implementation is, that there's a method to signal the monitor (for a single or multiple threads) and relinquish ownership in one step. On Windows this only summarizes two atomic ope- rations in one, but on __unix__ I increase efficiency by using a SysV semaphore set and with semop I can raise two semaphores at once so that I save one kernel-call. A monitor object has the disadvantage that you can't signal multiple states to different threads with it - it's functionally like a single mutex bound to a single condvar. So I wrote a dual_monitor class which allows bidirectional communications of two threads bound to the same mutual exclusion. You cann call notify(_all)( bool b ) on it where b is a bool that says which state has to be signalled. Theres no prority on either direction and the threads are awakened in an arbitrary order. There's also a notify_(all_)and_unlock( bool b ) method that does the same signalling and unlocking in one step as for the first monitor. But I'm still interested in the paper which describes the different approaches in implementing a condvar for Win32. Maybe I can implement some improvemehts here also. Chris, I _only_ want this paper and no chaotic descriptions, salves of chaotic postings, or chaotic sourcecode. Your replies are usually no help at all.
Back to comp.lang.c++ | Previous | Next — Next in thread | Find similar | Unroll thread
condvar-implementation Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-20 20:44 +0200
Re: condvar-implementation scott@slp53.sl.home (Scott Lurndal) - 2021-09-20 19:54 +0000
Re: condvar-implementation "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-09-20 15:52 -0700
Re: condvar-implementation Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-21 13:24 +0200
Re: condvar-implementation "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-09-21 16:08 -0700
Re: condvar-implementation "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-09-22 12:37 -0700
Re: condvar-implementation Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-23 06:18 +0200
Re: condvar-implementation "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-09-22 22:23 -0700
Re: condvar-implementation Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-23 09:09 +0000
Re: condvar-implementation "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-09-23 10:28 -0700
Re: condvar-implementation Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-23 19:06 +0200
Re: condvar-implementation Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-23 09:07 +0000
Re: condvar-implementation Bonita Montero <Bonita.Montero@gmail.com> - 2021-09-23 19:07 +0200
Re: condvar-implementation "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-09-21 16:33 -0700
csiph-web