Revision 995b7f4d

View differences:

client/cpp/include/MiddlewareRSB.h
85 85
    rsb::ListenerPtr inprotk_listener;
86 86
    rsb::ListenerPtr hack_listener;
87 87

  
88
    boost::mutex pending_tasks_mutex;
88
    std::mutex pending_tasks_mutex;
89 89
    std::vector<boost::shared_ptr<rst::communicationpatterns::TaskState>> pending_tasks;
90 90
    unsigned int say_task_active;
91 91
    unsigned int say_task_done;
92 92

  
93
    boost::mutex current_saytask_mutex;
93
    std::mutex current_saytask_mutex;
94 94
    std::string current_saytask;
95 95
    std::string get_current_saytask();
96 96
    void set_current_saytask(std::string text);
server/include/Arbiter.h
30 30
#include <string>
31 31
#include <vector>
32 32
#include <boost/shared_ptr.hpp>
33
#include <boost/thread/mutex.hpp>
33
#include <mutex>
34 34
#include <humotion/client/client.h>
35 35
#include "EmotionState.h"
36 36
#include "EmotionConfig.h"
......
91 91
    humotion::MouthState requested_mouth_state;
92 92

  
93 93

  
94
    boost::mutex emotion_config_default_mutex;
95
    boost::mutex emotion_config_current_mutex;
96
    boost::mutex mouth_config_override_mutex;
97
    boost::mutex utterance_mutex;
98
    boost::mutex requested_gaze_state_mutex;
99
    boost::mutex requested_mouth_state_mutex;
100
    boost::mutex audio_player_mutex;
94
    std::mutex emotion_config_default_mutex;
95
    std::mutex emotion_config_current_mutex;
96
    std::mutex mouth_config_override_mutex;
97
    std::mutex utterance_mutex;
98
    std::mutex requested_gaze_state_mutex;
99
    std::mutex requested_mouth_state_mutex;
100
    std::mutex audio_player_mutex;
101 101

  
102
    boost::mutex animation_mutex;
102
    std::mutex animation_mutex;
103 103
    Animation active_animation;
104 104

  
105 105
    typedef std::vector<boost::shared_ptr<Animation>> active_animation_vector_t;
106
    boost::mutex active_animation_vector_mutex;
106
    std::mutex active_animation_vector_mutex;
107 107
    active_animation_vector_t active_animation_vector;
108 108

  
109 109

  
server/src/Arbiter.cpp
30 30
#include "AudioPlayerLibAO.h"
31 31
#include "AudioPlayerRSB.h"
32 32
#include <boost/algorithm/string/predicate.hpp>
33
#include <boost/thread/mutex.hpp>
33
#include <mutex>
34
#include <thread>
34 35
#include <iostream>
35 36

  
36 37
using namespace boost;
......
68 69

  
69 70
void Arbiter::set_default_emotion(EmotionState e){
70 71
    //lock access
71
    boost::mutex::scoped_lock scoped_lock(emotion_config_default_mutex);
72
    const std::lock_guard<std::mutex> lock(emotion_config_default_mutex);
72 73

  
73 74
    //update our config, ignore duration as this is the default emotion
74 75
    emotion_config_default.select_config(e.value);
......
81 82

  
82 83
void Arbiter::set_current_emotion(EmotionState e){
83 84
    //lock access
84
    boost::mutex::scoped_lock scoped_lock(emotion_config_current_mutex);
85
    const std::lock_guard<std::mutex> lock(emotion_config_current_mutex);
85 86

  
86 87
    //this will set a emotion override for a given time, after the timeout
87 88
    //we will return to the default emotion state:
......
96 97

  
97 98
void Arbiter::set_mouth_config(MouthConfig m){
98 99
    //lock access
99
    boost::mutex::scoped_lock scoped_lock(mouth_config_override_mutex);
100
    const std::lock_guard<std::mutex> lock(mouth_config_override_mutex);
100 101

  
101 102
    mouth_config = m;
102 103
}
103 104

  
104 105
void Arbiter::set_gaze_target(humotion::GazeState target){
105 106
    //lock access
106
    boost::mutex::scoped_lock scoped_lock(requested_gaze_state_mutex);
107
    const std::lock_guard<std::mutex> lock(requested_gaze_state_mutex);
107 108

  
108 109
    requested_gaze_state = target;
109 110
}
110 111

  
111 112
void Arbiter::set_mouth_target(humotion::MouthState target){
112 113
    //lock access
113
    boost::mutex::scoped_lock scoped_lock(requested_mouth_state_mutex);
114
    const std::lock_guard<std::mutex> lock(requested_mouth_state_mutex);
114 115

  
115 116
    requested_mouth_state = target;
116 117
}
......
119 120
void Arbiter::play_animation(boost::shared_ptr<Animation> incoming_animation){
120 121
    //incoming animation, check if this would conflict with any pending animations:
121 122
    //lock access & iterate over vector:
122
    boost::mutex::scoped_lock lock_av(active_animation_vector_mutex);
123
    std::unique_lock<std::mutex> lock_av(active_animation_vector_mutex);
123 124
    active_animation_vector_t::iterator it;
124 125
    for(it = active_animation_vector.begin(); it<active_animation_vector.end(); it++){
125 126
        boost::shared_ptr<Animation> current_ani = *it;
......
162 163

  
163 164
void Arbiter::speak(boost::shared_ptr<Utterance> u){ //, ao_sample_format audio_format, char *audio_data, unsigned int audio_len){
164 165
    //lock audio playback as such:
165
    boost::mutex::scoped_lock scoped_lock_audio(audio_player_mutex);
166
    const std::lock_guard<std::mutex> lock_audio(audio_player_mutex);
166 167

  
167
    //lock utterance & store data:
168
    boost::mutex::scoped_lock scoped_lock(utterance_mutex);
169
    utterance = u;
170
    scoped_lock.unlock();
168
    {
169
        //lock utterance & store data:
170
        const std::lock_guard<std::mutex> lock(utterance_mutex);
171
        utterance = u;
172
    }
171 173

  
172 174
    //start audio playback, this function returns once we started playback
173 175
    if (audio_player == NULL){
......
272 274
    }
273 275

  
274 276
    //lock access
275
    boost::mutex::scoped_lock scoped_lock1(emotion_config_default_mutex);
277
    const std::lock_guard<std::mutex> lock1(emotion_config_default_mutex);
276 278

  
277 279

  
278 280
    // did the current emotion time out?
......
344 346

  
345 347
void Arbiter::override_by_animation(){
346 348
    //lock access & iterate over vector:
347
    boost::mutex::scoped_lock lock_av(active_animation_vector_mutex);
349
    const std::lock_guard<std::mutex> lock_av(active_animation_vector_mutex);
348 350
    active_animation_vector_t::iterator it;
349 351
    for(it = active_animation_vector.begin(); it<active_animation_vector.end(); it++){
350 352
        boost::shared_ptr<Animation> current_ani = *it;

Also available in: Unified diff