X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Fimage_input.cpp;fp=nageru%2Fimage_input.cpp;h=4b6840b1327508a2027364fcd196a6924a1a8252;hb=b44bf7cfce6a5aaffbcd1e37df39068a163438ad;hp=5f695702e7ffcbc3adb63127298afffec7b93f92;hpb=add8bb3a499cfeaad58bf5bdbda68391bab64059;p=nageru diff --git a/nageru/image_input.cpp b/nageru/image_input.cpp index 5f69570..4b6840b 100644 --- a/nageru/image_input.cpp +++ b/nageru/image_input.cpp @@ -63,7 +63,7 @@ void ImageInput::set_gl_state(GLuint glsl_program_num, const string& prefix, uns // so there's a fair amount of OpenGL memory waste anyway (the cache // is mostly there to save startup time, not RAM). { - unique_lock lock(all_images_lock); + lock_guard lock(all_images_lock); if (all_images[pathname] != current_image) { current_image = all_images[pathname]; set_pixel_data(current_image->pixels.get()); @@ -74,7 +74,7 @@ void ImageInput::set_gl_state(GLuint glsl_program_num, const string& prefix, uns shared_ptr ImageInput::load_image(const string &filename, const string &pathname) { - unique_lock lock(all_images_lock); // Held also during loading. + lock_guard lock(all_images_lock); // Held also during loading. if (all_images.count(pathname)) { return all_images[pathname]; } @@ -234,7 +234,7 @@ void ImageInput::update_thread_func(const std::string &filename, const std::stri continue; } fprintf(stderr, "Loaded new version of %s from disk.\n", pathname.c_str()); - unique_lock lock(all_images_lock); + lock_guard lock(all_images_lock); all_images[pathname] = image; last_modified = image->last_modified; } @@ -243,7 +243,7 @@ void ImageInput::update_thread_func(const std::string &filename, const std::stri void ImageInput::shutdown_updaters() { { - unique_lock lock(threads_should_quit_mu); + lock_guard lock(threads_should_quit_mu); threads_should_quit = true; threads_should_quit_modified.notify_all(); }