blob: 0256d70dc8724ee3ef6c46b5062a225e86c58635 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/**
* Default Initialization Function Source File
* (C) 1999-2007 Jack Lloyd
*/
#include <botan/init.h>
#include <botan/libstate.h>
namespace Botan {
/*************************************************
* Library Initialization *
*************************************************/
void LibraryInitializer::initialize(bool thread_safe)
{
try
{
/*
This two stage initialization process is because Library_State's
constructor will implicitly refer to global state through the
allocators and so for, so global_state() has to be a valid
reference before initialize() can be called. Yeah, gross.
*/
set_global_state(new Library_State);
global_state().initialize(thread_safe);
}
catch(...)
{
deinitialize();
throw;
}
}
/*************************************************
* Library Shutdown *
*************************************************/
void LibraryInitializer::deinitialize()
{
set_global_state(0);
}
}
|