[Botan-devel] Initializing Botan lazily
Boris
boriss at web.de
Mon Oct 8 01:29:04 EDT 2007
> -----Original Message-----
> From: botan-devel-bounces at randombit.net
> [mailto:botan-devel-bounces at randombit.net] On Behalf Of Jack Lloyd
> Sent: Monday, October 08, 2007 3:08 AM
> To: Botan Devel List
> Subject: [Botan-devel] Initializing Botan lazily
Hi Jack,
> [...]
> #
> # old_revision [d9acb02ac838cf503b190f0ffd73c645ec76ab15]
> #
> # patch "src/libstate.cpp"
> # from [ff89a1505fed854b0dce45db7b7ae802706785f4]
> # to [6b5f66445f9221b5e16cd1eac05fbae2c079de1c]
> #
> ============================================================
> --- src/libstate.cpp ff89a1505fed854b0dce45db7b7ae802706785f4
> +++ src/libstate.cpp 6b5f66445f9221b5e16cd1eac05fbae2c079de1c
> @@ -31,7 +31,7 @@ Library_State& global_state()
> Library_State& global_state()
> {
> if(!global_lib_state)
> - throw Invalid_State("Library was not initialized correctly");
> + LibraryInitializer::initialize();
> return (*global_lib_state);
> }
>
> And here's the checkin message:
> [...]
> | The question is how to get arguments from the outside world to the
> | constructor of the Library_State that is created inside of
> | global_state(): avoiding many self tests to save a bit of
> time (many
> | applications won't care about the extra cost but
> sometimes 2 or 3 ms
> | is important), and thread safety (beacuse you can't
> specify to use a
> | real mutex).
you could add another static function to set initializer options:
static void LibraryInitializer::initializer_options(const
InitializerOptions&);
However I'm not sure what the advantage is then of not calling
LibraryInitializer::initialize() directly. :)
Boris
More information about the botan-devel
mailing list