Simple implementation of observable patten in C