How do `ei_connect`'s non-"time-out" functions differ from the "time-out" ones?

The Erl_Interface’s ei_connect documentation has an entire section about this topic (Time-Out Functions), but I just started learning C, so I’m missing a lot of the context to properly understand it.

  • Are non-“time-out” functions blocking the same way the receive keyword does until receiving a message?
  • And “time-out” functions are the same as receive .. after .. end constructs?

For example, if I see ei_xreceive_msg_tmo() with a 1 ms time-out then that is to make the loop more responsive, right?

Are non-“time-out” functions blocking the same way the receive keyword does until receiving a message?

Yes. They block until something happens, like a received message, a received tick (ERL_TICK) or a failure.

And “time-out” functions are the same as receive .. after .. end constructs?

Yes. Same as the others but can also return “timeout”.

1 Like