@@ -357,14 +357,10 @@ \subsection{Small-Stack option}
357357The library can be compiled with the symbol \texttt {MP\_ SMALL\_ STACK\_ SIZE } defined, which results in
358358the temporary \texttt {MP\_ WARRAY }-sized stack buffers being put on the heap.
359359This comes with one problem, namely: formerly promised thread-safety isn't given anymore.
360- Therefore if the Small-Stack option is enabled while doing multi threading, the provided locking
361- mechanism shall be used.
362- For some use cases it can be desired to use the Small-Stack option, but there are no threads and
363- therefore we provide the possibility to disable locking by defining the symbol \texttt {MP\_ NO\_ LOCKING }.
360+ Therefore if the Small-Stack option is enabled while doing multi threading, one shall always initialize
361+ the library by calling \texttt {mp\_ warray\_ init() } once with the correct number of threads.
364362
365- In case one already knows how many threads must be supported, the symbol \texttt {MP\_ WARRAY\_ NUM } can
366- be useful. It can be pre-defined at compile time to the number of heap buffers created on automatic
367- initialisation. C.f. \ref {ch:SMALL_STACK_API } for the dynamic API and further details.
363+ C.f. \ref {ch:SMALL_STACK_API } for the API description and further details.
368364
369365\section {Purpose of LibTomMath }
370366Unlike GNU MP (GMP) Library, LIP, OpenSSL or various other commercial kits (Miracl), LibTomMath
@@ -839,27 +835,12 @@ \section{Small-Stack option}
839835
840836\index {mp\_ warray\_ init}
841837\begin {alltt }
842- mp_err mp_warray_init(size_t n_alloc, bool preallocate, mp_lock *lock );
838+ mp_err mp_warray_init(size_t n_alloc, bool preallocate);
843839\end {alltt }
844840
845841The flag \texttt {preallocate } controls whether the internal buffers --
846842\texttt {n\_ alloc } buffers of size \texttt {MP\_ WARRAY } -- will be allocated when
847843\texttt {mp\_ warray\_ init() } is called, or whether they will be allocated when required.
848- The \texttt {mp\_ lock } struct looks as follows and shall be used to protect the
849- internal structure when using the library in a multi-threaded application.
850-
851- \index {mp\_ lock}
852- \begin {alltt }
853- typedef struct {
854- int (*lock)(void *ctx);
855- int (*unlock)(void *ctx);
856- void *ctx;
857- } mp_lock;
858- \end {alltt }
859-
860- The \texttt {mp\_ lock.lock } resp. \texttt {mp\_ lock.unlock } functions will be called before resp.
861- after modifying the internal struct.
862- The \texttt {mp\_ lock.ctx } element will be passed to those functions.
863844
864845To free the internally allocated memory the following function shall be called.
865846
0 commit comments