view foosdk/sdk/foobar2000/helpers/rethrow.h @ 1:20d02a178406 default tip

*: check in everything else yay
author Paper <paper@tflc.us>
date Mon, 05 Jan 2026 02:15:46 -0500
parents
children
line wrap: on
line source

#pragma once

#include <functional>

#include <exception>

namespace ThreadUtils {
	class CRethrow {
	private:
		std::exception_ptr m_exception;
	public:
		bool exec( std::function<void () > f ) throw();
		void rethrow() const;
		bool didFail() const { return !!m_exception; }
		void clear() { m_exception = nullptr; }
	};
}