lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> I use lua library in Linux environment, but deadlock phenomenon, the
> following is part of the stack information:
> [...]
> The problem lies in the use of the following macro:
> #define l_popen(L,c,m) (fflush(NULL), popen(c,m))
> It is fflush(NULL) that causes the deadlock. I can avoid this deadlock
> problem if I don't call fflush before popen.
> So my question is:
> 1. Can I just remove fflush(NULL)? What are the risks?
> 2. If not, is there any other way to solve the problem?

This 'fflush' was introduced in commit 9b47cee8b2. Its comment says:

    better to flush all files before starting new process with popen

So, I don't think there is any problem in removing it.

-- Roberto