Click here to Skip to main content
15,889,216 members

Comments by David Serrano Martínez (Top 13 by date)

David Serrano Martínez 15-Mar-14 14:19pm View    
It is quite difficult to find an answer with only fragments of code. Maybe the problem lies in the notification part. Perhaps notify_one is never reached. I suppose "tpool->find(msg.source(), mobile_id.to_string(), t);" invokes some t methods. Are you sure after those invocations the mutex in t is properly released?
David Serrano Martínez 15-Mar-14 8:47am View    
Your implementation seems the canonical one, as described in:
http://www.boost.org/doc/libs/1_55_0/doc/html/thread/synchronization.html#thread.synchronization.condvar_ref
The only difference is that you get out of scope with a goto jump. Does it anything to do with your unique_lock correctly going out of scope? I really do not know. Perhaps you will have to try some little alternatives in order to figure out what it is going on.
David Serrano Martínez 13-Nov-13 8:06am View    
Thanks. After replacing "using" with "typedef", the (bad) behavior is the same. Maybe it could be a problem with g++ v.4.8.1-4.
David Serrano Martínez 13-Nov-13 7:22am View    
Checked. Exacty the same. Template parameters are correctly resolved.
David Serrano Martínez 31-Mar-13 7:39am View    
Are you sure your objective is properly stated? You should link a date of birth for each one of your students. So definitely creating a structure for holding your five students and another structure for holding a unique date of birth is a bizarre design to me.

You will also find multiple compilation errors. For instance, data() needs three arguments, not two. You are passing values to data() by value, not by reference and, inside data, you can set only one date of birth (????).

Please, reconsider what is exactly what you are trying to achieve with your code.