News for hackers. Stuff that matters.
Re:Hell is a multi-threaded C++ program (2006) by deepGem on Saturday September 02, 2017 @09:06PM (#15159128)
I am not as experienced as you are and I don't even know the term re-entrant functions but accidentally this is how I am now designing programs, mostly writing self contained functions that don't alter any global state. This approach has made my programming life hell because I am finding it incredibly hard to get rid of the old shared variables habit. What I have experienced is that shared data access is more or less inevitable and I design to restrict the shared data access at the database.
Re:Hell is a multi-threaded C++ program (2006) by ibrault on Saturday September 02, 2017 @09:57PM (#15159288)
Re-entrant is basically what you said, self-contained functions that don't depend on external state. The "re-entrant" part just means that, basically, the function can be "re-entered." If it gets interrupted in the middle of execution, it will still produce the same output no matter what, no matter how long it sleeps for.
Re:Hell is a multi-threaded C++ program (2006) by iainmerrick on Sunday September 03, 2017 @01:22AM (#15159820)
No, that's not what re-entrant means. A re-entrant function can be called multiple times at the same time.

That could be from different threads or from an interrupt handler. It can even come up in single-threaded code: you call function A() which internally calls B() which results in a nested call to A(). If A is re-entrant that's safe.

Re:Hell is a multi-threaded C++ program (2006) by jdc0589 on Saturday September 02, 2017 @09:19PM (#15159159)
a lot of the time you can restrict shared data access to at least being read-only, which helps a lot.