Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OTP behaviours: gen_fsm; gen_event. Practical examples?

I have used both the supervisor and gen_server behaviours, and I can understand the practical uses for both of them. However, I don't really understand the use of the gen_fsm and the gen_event behaviours. Can someone clarify with practical examples?

Thanks in advance

like image 389
danihodovic Avatar asked Jan 04 '14 04:01

danihodovic


1 Answers

One classic example for FSM would be lock with timeout which is mentioned in manual,

Another example which I implemented in my experience would be telephone lines, because phone have states, like ringing, connected, disconnected etc and some operations are allowed and some are not allowed during this states.

An example for event is logging used in https://github.com/basho/lager

like image 106
Marutha Avatar answered Sep 18 '22 12:09

Marutha