+ warning
This commit is contained in:
		
							parent
							
								
									646e3aacc9
								
							
						
					
					
						commit
						5105779eb6
					
				
							
								
								
									
										26
									
								
								chap/IPC.tex
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								chap/IPC.tex
									
									
									
									
									
								
							| @ -23,15 +23,16 @@ chose. | ||||
| \label{get-signal} | ||||
| \lstinputlisting[language=c]{code/get-signal.c} | ||||
| 
 | ||||
| Quand ce processus recevra le signal, la fonction \texttt{attraper} | ||||
| sera appelée de façon \textsl{asynchrone} et positionnera le drapeau. | ||||
| C'est dans le terme \textsl{asynchrone} que le diable a caché | ||||
| les détails. | ||||
| 
 | ||||
| \begin{verbatim} | ||||
| fubar $ make get-signal  | ||||
| gcc -Wall get-signal.c -o get-signal | ||||
| fubar $ ./get-signal & | ||||
| [1] 14001 | ||||
| fubar $ kill me, my pid is 14001 | ||||
| kill -USR1 14001 | ||||
| fubar $ count is 15 | ||||
| kill -USR1 14001 | ||||
| fubar $ count is 22 | ||||
| kill %1 | ||||
| fubar $  | ||||
| @ -39,6 +40,23 @@ fubar $ | ||||
| fubar $  | ||||
| \end{verbatim} | ||||
| 
 | ||||
| Comme on peut le constater, le principe est simple. Un signal est | ||||
| une interruption d'un processus qui, en dehors de sa présence, ne | ||||
| transfère que peu d'information. Le principe est simple, d'accord, | ||||
| mais la mise en œuvre l'est moins. | ||||
| Cet exemple peut être considéré comme obsolète, et la | ||||
| \textsl{manpage}\footnote{Mais qui lit le man, de nos jours ?} | ||||
| confime bien. | ||||
| 
 | ||||
| \begin{quote} | ||||
| The only portable use of signal() is to set a signal's  disposition  to | ||||
| SIG\_DFL  or  SIG\_IGN.  The semantics when using signal() to establish a | ||||
| signal handler vary across systems (and POSIX.1 explicitly permits this | ||||
| variation); \textbf{do not use it for this purpose}. | ||||
| \end{quote} | ||||
| 
 | ||||
| Vous voilà prévenus, la suite bientôt\dots | ||||
| 
 | ||||
| % ================================================================ | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 tth
						tth