Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 17c8e78

Browse files
committed
libqueue.tex: Documentation for the Queue.py module.
Makefile: Add dependency on libqueue.tex lib.tex: Place the libqueue.tex documentation just after libthread.tex since Queue depends on thread support in Python.
1 parent 51bb7b7 commit 17c8e78

5 files changed

Lines changed: 179 additions & 1 deletion

File tree

Doc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ LIBFILES = lib.tex \
113113
libbase64.tex libfnmatch.tex libquopri.tex libzlib.tex libsocksvr.tex \
114114
libmailbox.tex libcommands.tex libcmath.tex libni.tex libgzip.tex \
115115
libpprint.tex libcode.tex libmimify.tex libre.tex libmacic.tex \
116-
libuserdict.tex libdis.tex libxmllib.tex
116+
libuserdict.tex libdis.tex libxmllib.tex libqueue.tex
117117

118118
# Library document
119119
lib.dvi: $(LIBFILES)

Doc/lib.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
\input{libsocket}
128128
\input{libselect}
129129
\input{libthread}
130+
\input{libqueue}
130131
\input{libanydbm}
131132
\input{libwhichdb}
132133
\input{libzlib}

Doc/lib/lib.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
\input{libsocket}
128128
\input{libselect}
129129
\input{libthread}
130+
\input{libqueue}
130131
\input{libanydbm}
131132
\input{libwhichdb}
132133
\input{libzlib}

Doc/lib/libqueue.tex

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
\section{Standard module \sectcode{Queue}}
2+
\stmodindex{Queue}
3+
4+
\label{module-Queue}
5+
6+
% ==== 2. ====
7+
% Give a short overview of what the module does.
8+
% If it is platform specific, mention this.
9+
% Mention other important restrictions or general operating principles.
10+
% For example:
11+
12+
The \code{Queue} module implements a multi-producer, multi-consumer
13+
FIFO queue. It is especially useful in threads programming when
14+
information must be exchanged safely between multiple threads. The
15+
\code{Queue} class in this module implements all the required locking
16+
semantics. It depends on the availability of thread support in
17+
Python.
18+
19+
The \code{Queue} module defines the following exception:
20+
21+
\renewcommand{\indexsubitem}{(in module Queue)}
22+
23+
\begin{excdesc}{Empty}
24+
Exception raised when non-blocking get (e.g. \code{get_nowait()}) is
25+
called on a Queue object which is empty, or for which the emptyiness
26+
cannot be determined (i.e. because the appropriate locks cannot be
27+
acquired).
28+
\end{excdesc}
29+
30+
\subsection{Queue Objects}
31+
32+
Class \code{Queue} implements queue objects and has the methods
33+
described below. This class can be derived from in order to implement
34+
other queue organizations (e.g. stack) but the inheritable interface
35+
is not described here. See the source code for details. The public
36+
interface methods are:
37+
38+
\renewcommand{\indexsubitem}{(__init__ method)}
39+
40+
\begin{funcdesc}{__init__}{maxsize}
41+
Constructor for the class. \var{maxsize} is an integer that sets the
42+
upperbound limit on the number of items that can be placed in the
43+
queue. Insertion will block once this size has been reached, until
44+
queue items are consumed. If \var{maxsize} is less than or equal to
45+
zero, the queue size is infinite.
46+
\end{funcdesc}
47+
48+
\renewcommand{\indexsubitem}{(qsize method)}
49+
50+
\begin{funcdesc}{qsize}{}
51+
Returns the approximate size of the queue. Because of multithreading
52+
semantics, this number is not reliable.
53+
\end{funcdesc}
54+
55+
\renewcommand{\indexsubitem}{(empty method)}
56+
57+
\begin{funcdesc}{empty}{}
58+
Returns 1 if the queue is empty, 0 otherwise. Because of
59+
multithreading semantics, this is not reliable.
60+
\end{funcdesc}
61+
62+
\renewcommand{\indexsubitem}{(full method)}
63+
64+
\begin{funcdesc}{full}{}
65+
Returns 1 if the queue is full, 0 otherwise. Because of
66+
multithreading semantics, this is not reliable.
67+
\end{funcdesc}
68+
69+
\renewcommand{\indexsubitem}{(put method)}
70+
71+
\begin{funcdesc}{put}{item}
72+
Puts \var{item} into the queue.
73+
\end{funcdesc}
74+
75+
\renewcommand{\indexsubitem}{(get method)}
76+
77+
\begin{funcdesc}{get}{}
78+
Gets and returns an item from the queue, blocking if necessary until
79+
one is available.
80+
\end{funcdesc}
81+
82+
\renewcommand{\indexsubitem}{(get_nowait method)}
83+
84+
\begin{funcdesc}{get_nowait}{}
85+
Gets and returns an item from the queue if one is immediately
86+
available. Raises an \code{Empty} exception if the queue is empty or
87+
if the queue's emptiness cannot be determined.
88+
\end{funcdesc}

Doc/libqueue.tex

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
\section{Standard module \sectcode{Queue}}
2+
\stmodindex{Queue}
3+
4+
\label{module-Queue}
5+
6+
% ==== 2. ====
7+
% Give a short overview of what the module does.
8+
% If it is platform specific, mention this.
9+
% Mention other important restrictions or general operating principles.
10+
% For example:
11+
12+
The \code{Queue} module implements a multi-producer, multi-consumer
13+
FIFO queue. It is especially useful in threads programming when
14+
information must be exchanged safely between multiple threads. The
15+
\code{Queue} class in this module implements all the required locking
16+
semantics. It depends on the availability of thread support in
17+
Python.
18+
19+
The \code{Queue} module defines the following exception:
20+
21+
\renewcommand{\indexsubitem}{(in module Queue)}
22+
23+
\begin{excdesc}{Empty}
24+
Exception raised when non-blocking get (e.g. \code{get_nowait()}) is
25+
called on a Queue object which is empty, or for which the emptyiness
26+
cannot be determined (i.e. because the appropriate locks cannot be
27+
acquired).
28+
\end{excdesc}
29+
30+
\subsection{Queue Objects}
31+
32+
Class \code{Queue} implements queue objects and has the methods
33+
described below. This class can be derived from in order to implement
34+
other queue organizations (e.g. stack) but the inheritable interface
35+
is not described here. See the source code for details. The public
36+
interface methods are:
37+
38+
\renewcommand{\indexsubitem}{(__init__ method)}
39+
40+
\begin{funcdesc}{__init__}{maxsize}
41+
Constructor for the class. \var{maxsize} is an integer that sets the
42+
upperbound limit on the number of items that can be placed in the
43+
queue. Insertion will block once this size has been reached, until
44+
queue items are consumed. If \var{maxsize} is less than or equal to
45+
zero, the queue size is infinite.
46+
\end{funcdesc}
47+
48+
\renewcommand{\indexsubitem}{(qsize method)}
49+
50+
\begin{funcdesc}{qsize}{}
51+
Returns the approximate size of the queue. Because of multithreading
52+
semantics, this number is not reliable.
53+
\end{funcdesc}
54+
55+
\renewcommand{\indexsubitem}{(empty method)}
56+
57+
\begin{funcdesc}{empty}{}
58+
Returns 1 if the queue is empty, 0 otherwise. Because of
59+
multithreading semantics, this is not reliable.
60+
\end{funcdesc}
61+
62+
\renewcommand{\indexsubitem}{(full method)}
63+
64+
\begin{funcdesc}{full}{}
65+
Returns 1 if the queue is full, 0 otherwise. Because of
66+
multithreading semantics, this is not reliable.
67+
\end{funcdesc}
68+
69+
\renewcommand{\indexsubitem}{(put method)}
70+
71+
\begin{funcdesc}{put}{item}
72+
Puts \var{item} into the queue.
73+
\end{funcdesc}
74+
75+
\renewcommand{\indexsubitem}{(get method)}
76+
77+
\begin{funcdesc}{get}{}
78+
Gets and returns an item from the queue, blocking if necessary until
79+
one is available.
80+
\end{funcdesc}
81+
82+
\renewcommand{\indexsubitem}{(get_nowait method)}
83+
84+
\begin{funcdesc}{get_nowait}{}
85+
Gets and returns an item from the queue if one is immediately
86+
available. Raises an \code{Empty} exception if the queue is empty or
87+
if the queue's emptiness cannot be determined.
88+
\end{funcdesc}

0 commit comments

Comments
 (0)