[Pcsclite-cvs-commit] PCSC/doc pcsc-lite.tex,1.4,1.5

rousseau@haydn.debian.org rousseau@haydn.debian.org


Update of /cvsroot/pcsclite/PCSC/doc
In directory haydn:/tmp/cvs-serv20093

Modified Files:
	pcsc-lite.tex 
Log Message:
add the chapter "Multithreading and contexts"


Index: pcsc-lite.tex
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/doc/pcsc-lite.tex,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- pcsc-lite.tex	10 May 2004 13:14:30 -0000	1.4
+++ pcsc-lite.tex	10 May 2004 14:41:15 -0000	1.5
@@ -1479,6 +1479,34 @@
 \end{verbatim}
 
 
+%---------%---------%---------%---------%---------%---------%---------
+\section{Multithreading and contexts}
+
+From version 1.2.0 pcsc-lite is much more multithreading friendly.
+
+You have to follow some rules:
+
+\begin{itemize}
+\item For security reasons, a context can only be released (using
+\texttt{SCardReleaseContext()}) by the thread that created it.
+
+\item To access different readers (\emph{i.e.} cards) in different
+threads, each thread must use a different context (not necessarily
+created by this thread itself).
+
+\end{itemize}
+
+Each thread should create his own context with
+\texttt{SCardEstablishContext()} and should release it with
+\texttt{SCardReleaseContext()} when the context is not necessary any
+more.
+
+If different threads share a same context, the calls to different
+functions of the pcsc-lite API are stored in a queue and the executions
+serialised for this context because there is a mutex shared for all the
+(critical) operations of this context.
+
+
 %---------%---------%---------%---------%---------%---------
 \bibliographystyle{plain}
 \bibliography{pcsc-lite}