Sha256: 6aa114ada9d1d4b466a685e0a9ae76f81533d2dfa087966262b507cab099ae5c
Contents?: true
Size: 1.03 KB
Versions: 30
Compression:
Stored size: 1.03 KB
Contents
#include <Gosu/Async.hpp> #include <Gosu/Graphics.hpp> #include <Gosu/Image.hpp> #include <Gosu/Window.hpp> #include <boost/bind.hpp> using namespace boost; namespace Gosu { namespace { void asyncNewImage_Impl(Window& window, std::wstring filename, Window::SharedContext context, shared_ptr<try_mutex> mutex, shared_ptr<std::auto_ptr<Image> > result) { try_mutex::scoped_lock lock(*mutex); (*context)(); result->reset(new Image(window.graphics(), filename)); } } } Gosu::AsyncResult<Gosu::Image> Gosu::asyncNewImage(Window& window, const std::wstring& filename) { shared_ptr<try_mutex> mutex(new try_mutex); shared_ptr<std::auto_ptr<Image> > image(new std::auto_ptr<Image>); thread thread(bind(asyncNewImage_Impl, ref(window), filename, window.createSharedContext(), mutex, image)); return AsyncResult<Image>(mutex, image); }
Version data entries
30 entries across 30 versions & 1 rubygems