Is squirrel code on agent single or multi threaded?



I understand that squirrel code running on imp device is single-threaded. What about on the agent?

It’s probably a basic question but I couldn’t find information anywhere. Normally I would assume code on server will run multi-threaded but I don’t know if this applies to imp’s agent code. Knowing this would help me greatly in thinking about the problem I’m trying to solve.

Thank you.


From Squirrel’s point of view, agent code is single-threaded. Squirrel never interrupts other Squirrel, and callbacks (e.g. on HTTP complete) only happen when your agent is otherwise idle.

Our agent-server is itself multi-threaded at the C++/Erlang level, which helps it support large numbers of agents on each server machine – but to keep our users’ lives easier, each individual agent behaves in a strictly single-threaded way.



That makes sense: it’s much easier to think of device and agent code running in the same way. Thank you.