Revision 42084118

View differences:

client/cpp/include/MiddlewareRSB.h
81 81
	rsb::ListenerPtr inprotk_listener;
82 82
	rsb::ListenerPtr hack_listener;
83 83

  
84
	boost::mutex pending_tasks_mutex;
84
	std::mutex pending_tasks_mutex;
85 85
	std::vector<boost::shared_ptr<rst::communicationpatterns::TaskState> > pending_tasks;
86 86
	unsigned int say_task_active;
87 87
	unsigned int say_task_done;
88 88

  
89
	boost::mutex current_saytask_mutex;
89
	std::mutex current_saytask_mutex;
90 90
	std::string current_saytask;
91 91
	std::string get_current_saytask();
92 92
	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"
......
88 88
	humotion::GazeState requested_gaze_state;
89 89
	humotion::MouthState requested_mouth_state;
90 90

  
91
	boost::mutex emotion_config_default_mutex;
92
	boost::mutex emotion_config_current_mutex;
93
	boost::mutex mouth_config_override_mutex;
94
	boost::mutex utterance_mutex;
95
	boost::mutex requested_gaze_state_mutex;
96
	boost::mutex requested_mouth_state_mutex;
97
	boost::mutex audio_player_mutex;
91
	std::mutex emotion_config_default_mutex;
92
	std::mutex emotion_config_current_mutex;
93
	std::mutex mouth_config_override_mutex;
94
	std::mutex utterance_mutex;
95
	std::mutex requested_gaze_state_mutex;
96
	std::mutex requested_mouth_state_mutex;
97
	std::mutex audio_player_mutex;
98 98

  
99
	boost::mutex animation_mutex;
99
	std::mutex animation_mutex;
100 100
	Animation active_animation;
101 101

  
102 102
	typedef std::vector<boost::shared_ptr<Animation>> active_animation_vector_t;
103
	boost::mutex active_animation_vector_mutex;
103
	std::mutex active_animation_vector_mutex;
104 104
	active_animation_vector_t active_animation_vector;
105 105

  
106 106
	AudioPlayer* audio_player;
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;
......
71 72

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

  
76 77
	// update our config, ignore duration as this is the default emotion
77 78
	emotion_config_default.select_config(e.value);
......
84 85

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

  
89 90
	// this will set a emotion override for a given time, after the timeout
90 91
	// we will return to the default emotion state:
......
99 100

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

  
104 105
	mouth_config = m;
105 106
}
106 107

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

  
111 112
	requested_gaze_state = target;
112 113
}
113 114

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

  
118 119
	requested_mouth_state = target;
119 120
}
......
122 123
void Arbiter::play_animation(boost::shared_ptr<Animation> incoming_animation) {
123 124
	// incoming animation, check if this would conflict with any pending animations:
124 125
	// lock access & iterate over vector:
125
	boost::mutex::scoped_lock lock_av(active_animation_vector_mutex);
126
	std::unique_lock<std::mutex> lock_av(active_animation_vector_mutex);
126 127
	active_animation_vector_t::iterator it;
127 128
	for (it = active_animation_vector.begin(); it < active_animation_vector.end(); it++) {
128 129
		boost::shared_ptr<Animation> current_ani = *it;
......
167 168
void Arbiter::speak(
168 169
   boost::shared_ptr<Utterance> u) { //, ao_sample_format audio_format, char *audio_data, unsigned int audio_len){
169 170
	// lock audio playback as such:
170
	boost::mutex::scoped_lock scoped_lock_audio(audio_player_mutex);
171
	const std::lock_guard<std::mutex> lock_audio(audio_player_mutex);
171 172

  
172
	// lock utterance & store data:
173
	boost::mutex::scoped_lock scoped_lock(utterance_mutex);
174
	utterance = u;
175
	scoped_lock.unlock();
173
	{
174
		// lock utterance & store data:
175
		const std::lock_guard<std::mutex> lock(utterance_mutex);
176
		utterance = u;
177
	}
176 178

  
177 179
	// start audio playback, this function returns once we started playback
178 180
	if (audio_player == NULL) {
......
279 281
	}
280 282

  
281 283
	// lock access
282
	boost::mutex::scoped_lock scoped_lock1(emotion_config_default_mutex);
284
	const std::lock_guard<std::mutex> lock1(emotion_config_default_mutex);
283 285

  
284 286
	// did the current emotion time out?
285 287
	if (!emotion_target->is_active()) {
......
351 353

  
352 354
void Arbiter::override_by_animation() {
353 355
	// lock access & iterate over vector:
354
	boost::mutex::scoped_lock lock_av(active_animation_vector_mutex);
356
	const std::lock_guard<std::mutex> lock_av(active_animation_vector_mutex);
355 357
	active_animation_vector_t::iterator it;
356 358
	for (it = active_animation_vector.begin(); it < active_animation_vector.end(); it++) {
357 359
		boost::shared_ptr<Animation> current_ani = *it;

Also available in: Unified diff