TTMath  0.9.4
 C++ bignum library
Public Member Functions
ttmath::ThreadLock Class Reference

objects of this class are used to synchronize More...

#include <ttmaththreads.h>

Public Member Functions

bool Lock ()
 

Detailed Description

objects of this class are used to synchronize

this is a simple skeleton of a program in multithreads environment:

#define TTMATH_MULTITHREADS
#include<ttmath/ttmath.h>

TTMATH_MULTITHREADS_HELPER

int main()
{
[...]
}

make sure that macro TTMATH_MULTITHREADS is defined and (somewhere in *.cpp file) use TTMATH_MULTITHREADS_HELPER macro (outside of any classes/functions/namespaces scope)

Definition at line 188 of file ttmaththreads.h.

Member Function Documentation

§ Lock()

bool ttmath::ThreadLock::Lock ( )

lock the current thread

it uses a global mutex created by TTMATH_MULTITHREADS_HELPER macro

Definition at line 197 of file ttmaththreads.h.

198  {
199  if( pthread_mutex_lock(&ttmath_mutex) != 0 )
200  return false;
201 
202  return true;
203  }
pthread_mutex_t ttmath_mutex

The documentation for this class was generated from the following file: