Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming.threads > #1268
| Newsgroups | comp.programming.threads |
|---|---|
| Date | 2012-12-23 20:02 -0800 |
| References | <d54451ed-576c-4873-b031-c03509ccc8e0@googlegroups.com> <0.a47ead5e11f16b983c51.20121221144029GMT.87a9t78o4i.fsf@bsb.me.uk> |
| Message-ID | <fcba6a20-e725-4b1c-af1e-4a283a37b191@googlegroups.com> (permalink) |
| Subject | Re: Have you ever seen real world lost wake-up problems? |
| From | Tian Tan <silverbullettt@gmail.com> |
> And what CV implementation allows one to specify the thread that should > > be woken up? If there can be only one waiting thread, there's nothing > > lost by using the conventional signalling mechanism, and if there can be > > many waiting threads, targeting the notification is almost certainly > > going to cause problems. > What does it mean? Why multi-waiting-threads is going to cause problems? > You might also lack some knowledge as well. Obviously I can't tell, but > > the example above looks so wrong it doesn't seem likely to be common > > patter for a bug. > You're right, it's too naive. CV shouldn't be used like that. > It's not clear what the bug is you are talking about. Anyway, I lack the > > experience to estimate how common any particular synchronisation bug is. > The bug which I'm talking about can be concluded like this: http://docs.oracle.com/cd/E19253-01/816-5137/sync-30/index.html > > Yes. You just need to use CVs correctly -- associate them with a real > > condition and a mutex (or lock) and test the condition in a loop with > > the correct locking: > > > > mutex.lock() > > while (the condition I need is not true) > > cv.wait(mutex); > > mutex.unlock(); > > If you find examples of incorrectly used condition variables, that would > > have some value (you could submit bug reports for example) but if it is > > valuable enough to spend time looking for them, I can't say. > It's helpful, thank you Ben. -- TT
Back to comp.programming.threads | Previous | Next — Previous in thread | Find similar
Have you ever seen real world lost wake-up problems? Tian Tan <silverbullettt@gmail.com> - 2012-12-20 00:19 -0800
Re: Have you ever seen real world lost wake-up problems? Lucas Levrel <lucas.levrel@u-pec.fr> - 2012-12-21 14:33 +0100
Re: Have you ever seen real world lost wake-up problems? Tian Tan <silverbullettt@gmail.com> - 2012-12-23 07:11 -0800
Re: Have you ever seen real world lost wake-up problems? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-12-21 14:40 +0000
Re: Have you ever seen real world lost wake-up problems? Tian Tan <silverbullettt@gmail.com> - 2012-12-23 20:02 -0800
csiph-web