-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCom.html
258 lines (223 loc) · 17.8 KB
/
Com.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module Com</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>Com</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/Users/bapt/Documents/S9/Info902/Projet/INFO901/Com.py">/Users/bapt/Documents/S9/Info902/Projet/INFO901/Com.py</a></font></td></tr></table>
<p></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="gevent.html">gevent</a><br>
<a href="multiprocessing.html">multiprocessing</a><br>
</td><td width="25%" valign=top><a href="os.html">os</a><br>
<a href="sys.html">sys</a><br>
</td><td width="25%" valign=top><a href="threading.html">threading</a><br>
<a href="time.html">time</a><br>
</td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="threading.html#Thread">threading.Thread</a>(<a href="builtins.html#object">builtins.object</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="Com.html#Com">Com</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Com">class <strong>Com</strong></a>(<a href="threading.html#Thread">threading.Thread</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt><a href="#Com">Com</a>(process, has_token=False)<br>
<br>
Classe Communicator (<a href="#Com">Com</a>) qui gère la communication entre les processus via un bus d'événements<br>
et utilise une horloge de Lamport pour la synchronisation des événements.<br>
<br>
Attributs:<br>
- process (Process): Le processus auquel ce communicateur est associé.<br>
- clock (int): L'horloge logique de Lamport utilisée pour la synchronisation.<br>
- semaphore (Semaphore): Utilisé pour gérer les accès concurrents à l'horloge.<br>
- mailbox (list): Liste des messages reçus par le processus.<br>
- nbProcess (int): Le nombre total de processus dans le système.<br>
- token (Token): Jeton utilisé pour la section critique si ce processus en possède un.<br>
- messageReceived (bool): Indique si un message a été reçu.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="Com.html#Com">Com</a></dd>
<dd><a href="threading.html#Thread">threading.Thread</a></dd>
<dd><a href="builtins.html#object">builtins.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="Com-__init__"><strong>__init__</strong></a>(self, process, has_token=False)</dt><dd><tt>Initialise le communicateur pour un processus.<br>
<br>
:param process: L'objet Process associé à ce communicateur.<br>
:param has_token: Indique si ce processus possède le jeton initial.</tt></dd></dl>
<dl><dt><a name="Com-addMessageToMailbox"><strong>addMessageToMailbox</strong></a>(self, msg: Message.Message)</dt><dd><tt>Ajoute un message à la boîte aux lettres du processus.<br>
<br>
:param msg: Le message à ajouter.</tt></dd></dl>
<dl><dt><a name="Com-broadcast"><strong>broadcast</strong></a>(self, payload: object)</dt><dd><tt>Envoie un message à tous les autres processus via le bus d'événements.<br>
<br>
:param payload: Le contenu du message à envoyer.</tt></dd></dl>
<dl><dt><a name="Com-broadcastSync"><strong>broadcastSync</strong></a>(self, sender, payload)</dt><dd><tt>Méthode de diffusion synchrone.<br>
<br>
:param sender: Le processus émetteur.<br>
:param payload: Le message à diffuser.</tt></dd></dl>
<dl><dt><a name="Com-getFirstMessage"><strong>getFirstMessage</strong></a>(self) -> Message.Message</dt><dd><tt>Retourne et retire le premier message de la boîte aux lettres.<br>
<br>
:return: Le premier message de la boîte aux lettres.</tt></dd></dl>
<dl><dt><a name="Com-get_clock"><strong>get_clock</strong></a>(self)</dt><dd><tt>Retourne la valeur actuelle de l'horloge logique de Lamport.<br>
<br>
:return: La valeur de l'horloge.</tt></dd></dl>
<dl><dt><a name="Com-inc_clock"><strong>inc_clock</strong></a>(self)</dt><dd><tt>Incrémente l'horloge logique de Lamport pour ce processus.<br>
<br>
:return: La nouvelle valeur de l'horloge.</tt></dd></dl>
<dl><dt><a name="Com-onBroadcast"><strong>onBroadcast</strong></a> = wrapper(*args, **kwargs)</dt></dl>
<dl><dt><a name="Com-onMessageTo"><strong>onMessageTo</strong></a> = wrapper(*args, **kwargs)</dt></dl>
<dl><dt><a name="Com-onMessageToSync"><strong>onMessageToSync</strong></a> = wrapper(*args, **kwargs)</dt></dl>
<dl><dt><a name="Com-onReceivFromSync"><strong>onReceivFromSync</strong></a> = wrapper(*args, **kwargs)</dt></dl>
<dl><dt><a name="Com-onSynchronize"><strong>onSynchronize</strong></a> = wrapper(*args, **kwargs)</dt></dl>
<dl><dt><a name="Com-on_token"><strong>on_token</strong></a> = wrapper(*args, **kwargs)</dt></dl>
<dl><dt><a name="Com-receivFromSync"><strong>receivFromSync</strong></a>(self)</dt><dd><tt>Méthode pour attendre la réception d'un message synchrone.<br>
<br>
:raises: La méthode bloque tant qu'aucun message n'est reçu.</tt></dd></dl>
<dl><dt><a name="Com-releaseToken"><strong>releaseToken</strong></a>(self)</dt><dd><tt>Libère le jeton pour permettre à un autre processus d'entrer dans la section critique.</tt></dd></dl>
<dl><dt><a name="Com-requestToken"><strong>requestToken</strong></a>(self)</dt><dd><tt>Demande l'accès à la section critique et bloque tant que le jeton n'est pas détenu.</tt></dd></dl>
<dl><dt><a name="Com-sendTo"><strong>sendTo</strong></a>(self, payload, to)</dt><dd><tt>Envoie un message dédié à un autre processus via le bus d'événements.<br>
<br>
:param payload: Le contenu du message.<br>
:param to: Le destinataire du message.</tt></dd></dl>
<dl><dt><a name="Com-sendToSync"><strong>sendToSync</strong></a>(self, payload, to)</dt><dd><tt>Envoie un message dédié à un autre processus en mode synchrone.<br>
<br>
:param payload: Le message à envoyer.<br>
:param to: Le destinataire du message.</tt></dd></dl>
<dl><dt><a name="Com-sendTokenTo"><strong>sendTokenTo</strong></a>(self, token: Message.Token)</dt><dd><tt>Envoie le jeton au processus suivant.<br>
<br>
:param token: Le jeton à envoyer.</tt></dd></dl>
<dl><dt><a name="Com-synchronize"><strong>synchronize</strong></a>(self)</dt><dd><tt>Synchronise le processus avec les autres en atteignant un point de synchronisation.</tt></dd></dl>
<hr>
Methods inherited from <a href="threading.html#Thread">threading.Thread</a>:<br>
<dl><dt><a name="Com-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Return repr(self).</tt></dd></dl>
<dl><dt><a name="Com-getName"><strong>getName</strong></a>(self)</dt><dd><tt>Return a string used for identification purposes only.<br>
<br>
This method is deprecated, use the name attribute instead.</tt></dd></dl>
<dl><dt><a name="Com-isDaemon"><strong>isDaemon</strong></a>(self)</dt><dd><tt>Return whether this thread is a daemon.<br>
<br>
This method is deprecated, use the daemon attribute instead.</tt></dd></dl>
<dl><dt><a name="Com-is_alive"><strong>is_alive</strong></a>(self)</dt><dd><tt>Return whether the thread is alive.<br>
<br>
This method returns True just before the <a href="#Com-run">run</a>() method starts until just<br>
after the <a href="#Com-run">run</a>() method terminates. See also the module function<br>
enumerate().</tt></dd></dl>
<dl><dt><a name="Com-join"><strong>join</strong></a>(self, timeout=None)</dt><dd><tt>Wait until the thread terminates.<br>
<br>
This blocks the calling thread until the thread whose <a href="#Com-join">join</a>() method is<br>
called terminates -- either normally or through an unhandled exception<br>
or until the optional timeout occurs.<br>
<br>
When the timeout argument is present and not None, it should be a<br>
floating point number specifying a timeout for the operation in seconds<br>
(or fractions thereof). As <a href="#Com-join">join</a>() always returns None, you must call<br>
<a href="#Com-is_alive">is_alive</a>() after <a href="#Com-join">join</a>() to decide whether a timeout happened -- if the<br>
thread is still alive, the <a href="#Com-join">join</a>() call timed out.<br>
<br>
When the timeout argument is not present or None, the operation will<br>
block until the thread terminates.<br>
<br>
A thread can be <a href="#Com-join">join</a>()ed many times.<br>
<br>
<a href="#Com-join">join</a>() raises a RuntimeError if an attempt is made to join the current<br>
thread as that would cause a deadlock. It is also an error to <a href="#Com-join">join</a>() a<br>
thread before it has been started and attempts to do so raises the same<br>
exception.</tt></dd></dl>
<dl><dt><a name="Com-run"><strong>run</strong></a>(self)</dt><dd><tt>Method representing the thread's activity.<br>
<br>
You may override this method in a subclass. The standard <a href="#Com-run">run</a>() method<br>
invokes the callable object passed to the object's constructor as the<br>
target argument, if any, with sequential and keyword arguments taken<br>
from the args and kwargs arguments, respectively.</tt></dd></dl>
<dl><dt><a name="Com-setDaemon"><strong>setDaemon</strong></a>(self, daemonic)</dt><dd><tt>Set whether this thread is a daemon.<br>
<br>
This method is deprecated, use the .daemon property instead.</tt></dd></dl>
<dl><dt><a name="Com-setName"><strong>setName</strong></a>(self, name)</dt><dd><tt>Set the name string for this thread.<br>
<br>
This method is deprecated, use the name attribute instead.</tt></dd></dl>
<dl><dt><a name="Com-start"><strong>start</strong></a>(self)</dt><dd><tt>Start the thread's activity.<br>
<br>
It must be called at most once per thread object. It arranges for the<br>
object's <a href="#Com-run">run</a>() method to be invoked in a separate thread of control.<br>
<br>
This method will raise a RuntimeError if called more than once on the<br>
same thread object.</tt></dd></dl>
<hr>
Readonly properties inherited from <a href="threading.html#Thread">threading.Thread</a>:<br>
<dl><dt><strong>ident</strong></dt>
<dd><tt>Thread identifier of this thread or None if it has not been started.<br>
<br>
This is a nonzero integer. See the get_ident() function. Thread<br>
identifiers may be recycled when a thread exits and another thread is<br>
created. The identifier is available even after the thread has exited.</tt></dd>
</dl>
<dl><dt><strong>native_id</strong></dt>
<dd><tt>Native integral thread ID of this thread, or None if it has not been started.<br>
<br>
This is a non-negative integer. See the get_native_id() function.<br>
This represents the Thread ID as reported by the kernel.</tt></dd>
</dl>
<hr>
Data descriptors inherited from <a href="threading.html#Thread">threading.Thread</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
<dl><dt><strong>daemon</strong></dt>
<dd><tt>A boolean value indicating whether this thread is a daemon thread.<br>
<br>
This must be set before start() is called, otherwise RuntimeError is<br>
raised. Its initial value is inherited from the creating thread; the<br>
main thread is not a daemon thread and therefore all threads created in<br>
the main thread default to daemon = False.<br>
<br>
The entire Python program exits when only daemon threads are left.</tt></dd>
</dl>
<dl><dt><strong>name</strong></dt>
<dd><tt>A string used for identification purposes only.<br>
<br>
It has no semantics. Multiple threads may be given the same name. The<br>
initial name is set by the constructor.</tt></dd>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-sleep"><strong>sleep</strong></a>(...)</dt><dd><tt><a href="#-sleep">sleep</a>(seconds)<br>
<br>
Delay execution for a given number of seconds. The argument may be<br>
a floating point number for subsecond precision.</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>PyBus</strong> = <pyeventbus3.Singleton.Singleton object><br>
<strong>default_conf</strong> = {'max_threads': 10}<br>
<strong>exitFlag</strong> = 0</td></tr></table>
</body></html>