Introducing Erlang: Getting Started in Functional Programming by Simon St. Laurent

Introducing Erlang: Getting Started in Functional Programming by Simon St. Laurent

Author:Simon St. Laurent [Laurent, Simon St.]
Language: eng
Format: azw3, pdf
Publisher: O'Reilly Media
Published: 2017-03-06T05:00:00+00:00


1> Pid1=spawn(bounce,report,[1]). <0.33.0> 2> register(bounce,Pid1). true 3> bounce ! hello. Received #1: hello hello ok 4> bounce ! "Really?". Received #2: "Really?" "Really?" ok

If you attempt to call a process that doesn’t exist (or one that has crashed), you’ll get a bad argument error:

6> zingo ! test. ** exception error: bad argument in operator !/2 called as zingo ! test

If you attempt to register a process to a name that is already in use, you’ll also get an error, but if a process has exited (or crashed), the name is effectively no longer in use and you can re-register it.

You can also use whereis/1 to retrieve the pid for a registered process (or undefined, if there is no process registered with that atom), and unregister/1 to take a process out of the registration list without killing it:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.