进程
来源:互联网 发布:php高级培训 编辑:程序博客网 时间:2024/06/08 18:02
loop()->receive {rectangle,Width,Ht}->io:format("area of rectangle is ~p~n",[ Width*Ht]), loop(); {circle,R}-> io:format("area of circle is ~p~n",[ R*R*3.1415926]), loop();Other->io:format("area of circle is ~p~n",[Other]), loop()end.
Pid=spawn(fun area_server:loop/0).
书上滴 进程滴应用 创建一个进程对loop求值
Pid!{self(),{rectangle,6,10}}.
loop()->receive {Form,{rectangle,Width,Ht}}->Form!Width*Ht,%io:format("area of rectangle is ~p~n",[ Width*Ht]), loop(); {From,{circle,R}}-> io:format("area of circle is ~p~n",[ R*R*3.1415926]), loop();Other->io:format("area of circle is ~p~n",[Other]), loop()end.
带超时滴 receive
loop()->receive {Form,{rectangle,Width,Ht}}->Form!Width*Ht,%io:format("area of rectangle is ~p~n",[ Width*Ht]), loop(); {From,{circle,R}}-> io:format("area of circle is ~p~n",[ R*R*3.1415926]), loop();Other->io:format("area of circle is ~p~n",[Other]), loop()after 0->trueend.
0 0
- 进程
- 进程
- 进程
- 进程
- 进程
- 进程
- 进程
- 进程
- 进程
- 进程
- 进程
- 进程
- 进程
- 进程
- 进程
- 进程
- 进程
- 进程
- android将字串转换成文件存储
- 详解Linux运维工程师必备技能【转】
- “塔康”导航系统
- 存储过程调试
- Appium基于安卓的各种FindElement的控件定位方法实践和建议
- 进程
- 基于3G网络的汽车防盗报警系统视频监控设计[图]
- Appium0.18.x迁移到Appium1.x须知事项(灰常有用,解答了本人几个疑问)
- C++学习总结
- jqueryui dialog
- flowplayer(html5和flash)播放器
- c#类,封装了键盘,和鼠标模拟,和内存读取
- 1049. Counting Ones (30)
- 基于Pushlet实现的Web版报价系统