mirror of
https://github.com/matrix-construct/construct
synced 2025-01-14 00:34:18 +01:00
modules/media/magick: Make greedy use of globals/callbacks; disable their OpenMP threads.
This commit is contained in:
parent
48c1e30930
commit
c1433402c0
1 changed files with 23 additions and 26 deletions
|
@ -72,7 +72,24 @@ ircd::magick::init()
|
|||
};
|
||||
|
||||
::InitializeMagick(nullptr);
|
||||
::SetLogMethod(handle_log); //XXX assuming global
|
||||
::SetLogMethod(handle_log);
|
||||
::SetWarningHandler(handle_warning);
|
||||
::SetErrorHandler(handle_error);
|
||||
::SetFatalErrorHandler(handle_fatal);
|
||||
::SetMagickResourceLimit(ThreadsResource, 1UL);
|
||||
|
||||
log::debug
|
||||
{
|
||||
log, "resource settings: pixel max:%lu:%lu height:%lu:%lu width:%lu:%lu; threads:%lu:%lu",
|
||||
::GetMagickResource(PixelsResource),
|
||||
::GetMagickResourceLimit(PixelsResource),
|
||||
::GetMagickResource(HeightResource),
|
||||
::GetMagickResourceLimit(HeightResource),
|
||||
::GetMagickResource(WidthResource),
|
||||
::GetMagickResourceLimit(WidthResource),
|
||||
::GetMagickResource(ThreadsResource),
|
||||
::GetMagickResourceLimit(ThreadsResource),
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -157,14 +174,14 @@ return_t
|
|||
ircd::magick::callex(function&& f,
|
||||
args&&... a)
|
||||
{
|
||||
const auto warning_handler(::SetWarningHandler(handle_warning));
|
||||
const auto fatal_handler(::SetFatalErrorHandler(handle_fatal));
|
||||
const auto error_handler(::SetErrorHandler(handle_exception));
|
||||
const auto error_handler
|
||||
{
|
||||
::SetErrorHandler(handle_exception)
|
||||
};
|
||||
|
||||
const unwind reset{[&]
|
||||
{
|
||||
::SetFatalErrorHandler(fatal_handler);
|
||||
::SetErrorHandler(error_handler);
|
||||
::SetWarningHandler(warning_handler);
|
||||
}};
|
||||
|
||||
::ExceptionInfo ei;
|
||||
|
@ -191,16 +208,6 @@ void
|
|||
ircd::magick::callpf(function&& f,
|
||||
args&&... a)
|
||||
{
|
||||
const auto warning_handler(::SetWarningHandler(handle_warning));
|
||||
const auto fatal_handler(::SetFatalErrorHandler(handle_fatal));
|
||||
const auto error_handler(::SetErrorHandler(handle_error));
|
||||
const unwind reset{[&]
|
||||
{
|
||||
::SetFatalErrorHandler(fatal_handler);
|
||||
::SetErrorHandler(error_handler);
|
||||
::SetWarningHandler(warning_handler);
|
||||
}};
|
||||
|
||||
if(!call(f, std::forward<args>(a)...))
|
||||
throw error{};
|
||||
}
|
||||
|
@ -212,16 +219,6 @@ return_t
|
|||
ircd::magick::call(function&& f,
|
||||
args&&... a)
|
||||
{
|
||||
const auto warning_handler(::SetWarningHandler(handle_warning));
|
||||
const auto fatal_handler(::SetFatalErrorHandler(handle_fatal));
|
||||
const auto error_handler(::SetErrorHandler(handle_error));
|
||||
const unwind reset{[&]
|
||||
{
|
||||
::SetFatalErrorHandler(fatal_handler);
|
||||
::SetErrorHandler(error_handler);
|
||||
::SetWarningHandler(warning_handler);
|
||||
}};
|
||||
|
||||
return f(std::forward<args>(a)...);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue