]> Dogcows Code - chaz/talk-event-driven-programming-in-perl/commitdiff
add SIGPIPE slides
authorCharles McGarvey <cmcgarvey@bluehost.com>
Sun, 17 Jun 2018 21:58:06 +0000 (15:58 -0600)
committerCharles McGarvey <cmcgarvey@bluehost.com>
Sun, 17 Jun 2018 22:15:28 +0000 (16:15 -0600)
css/slides.css
notes.txt
slides.html

index abeeb120a86f042c290051081a841c87d8d1b4d2..e32cb1075e2989c7e69965062ca489da0b3b9e44 100644 (file)
     font-size: 38px;
 }
 
+.sigpipe ul {
+    font-size: 34px;
+}
+.ex-sigpipe .perl {
+    font-size: 38px;
+}
+
+
index 0d32c72821b78cfa6b92dd54fbd93df17c9fa3a3..6b732a6f54b44de687634bea5df81339c0a1ffbe 100644 (file)
--- a/notes.txt
+++ b/notes.txt
@@ -27,10 +27,10 @@ X kernel facilities (poll, select, etc.)
 - Mojo::IOLoop
 
 6. Special considerations
-- Exceptions in event-driven code.
-- SIGPIPE, EPIPE - might have more to do with long-lived processes rather than
+X Exceptions in event-driven code.
+X SIGPIPE, EPIPE - might have more to do with long-lived processes rather than
   just event-driven programming, but still something to watch out for...
-- You should almost always check the return code of your syscalls to see if they succeeded or not.
+X You should almost always check the return code of your syscalls to see if they succeeded or not.
 
 7. Promises:
 - Future
index 6d589b4552d0e1edcb157ecabcd8f1e42d7d6b5f..51f91018b47b58dc661ea16ec0f31ef6e68920f0 100644 (file)
@@ -498,6 +498,39 @@ $promise->on_fail(sub { ... });
 ---
 class: center, middle
 
+## `SIGPIPE`
+
+---
+class: sigpipe
+## `SIGPIPE`
+
+- Sent to your program when it writes to a pipe that was closed.
+
+--
+- Default signal handler terminates the program.
+
+---
+class: ex-sigpipe
+
+## Solution: Ignore `SIGPIPE`
+
+```perl
+$SIG{PIPE} = 'IGNORE';
+```
+
+???
+Some event loops do this for you.
+
+--
+.big[
+Look for `EPIPE` from syscalls (like [`write`](http://man.he.net/man2/write)) instead.
+
+(You *are* checking return codes from your system calls... right?)
+]
+
+---
+class: center, middle
+
 ## Use [`Future::AsyncAwait`](https://metacpan.org/pod/Future::AsyncAwait).
 
 ???
This page took 0.023047 seconds and 4 git commands to generate.