[Botan-devel] mux_win32 missing?

Jack Lloyd lloyd at randombit.net
Sat Jan 1 15:11:24 EST 2005

Hi Elliot,

Unfortunately, no such module exists. Well, that is not exactly true. A company
sent me a bunch of modules for use on Windows, but we never cleared up the
copyright stuff, so I don't want to risk distributing them. It's easy to code,
but you're the first person who has wanted it, as far as I know.

I don't have a Windows machine handy at the moment, but you basically want
something like:

class Win32_Mutex : public Botan::Mutex
      void lock() { EnterCriticalSection(&mux); }
      void unlock() { LeaveCriticalSection(&mux); }
      Mutex* clone() const { return new Win32_Mutex; }

      Win32_Mutex() { InitializeCriticalSection(&mux); }
      ~Win32_Mutex() { DeleteCriticalSection(&mux); }

which I have not tested at all, but it looks OK, and it's at least close enough
to give you the idea. Then call 'Botan::Init::set_mutex(new Win32_Mutex);'
(before creating the LibraryInitializer), and don't pass thread_safe as an

That should handle everything, but let me know if you run into problems. BTW,
was I the only one who didn't see this message until today? I'm wondering if
there is something screwy with Mailman.


On Wed, Dec 29, 2004 at 01:12:31AM -0700, Elliot Turner wrote:
> Greetings,
> I am attempting to utilize Botan in thread_safe mode on the Win32 platform.
> Creating a Botan::LibraryInitializer object with the constructor 
> argument "thread_safe" currently throws an exception, with the error 
> "thread safety is impossible".
> It appears that the mux_win32 mutex implementation is missing from the 
> 1.4.4 distribution, which is resulting in the inability to allocate a 
> Win32_Mutex object and the exception.
> Is this file available?
> Regards,
> Elliot Turner
> _______________________________________________
> botan-devel mailing list
> botan-devel at randombit.net
> http://www.randombit.net/mailman/listinfo/botan-devel

More information about the botan-devel mailing list