[sqlite] SQLite, fork(), and exec()

2015-08-10 Thread Richard Hipp
On 8/10/15, Felipe Gasper  wrote:
> Hi everyone,
>
>   Does SQLite need to have nothing at all to do with fork()? Even when
> the fork() immediately precedes an exec(), and the exec()ed command has
> nothing to do with SQLite?
>
>   Or is it only a problem if the child process *uses* SQLite?
>

I think it is only a problem if the child process tries to use SQLite.

-- 
D. Richard Hipp
drh at sqlite.org


[sqlite] SQLite, fork(), and exec()

2015-08-10 Thread Felipe Gasper
Hi everyone,

Does SQLite need to have nothing at all to do with fork()? Even when 
the fork() immediately precedes an exec(), and the exec()ed command has 
nothing to do with SQLite?

Or is it only a problem if the child process *uses* SQLite?

-F


[sqlite] SQLite, fork(), and exec()

2015-08-10 Thread Nico Williams
On Mon, Aug 10, 2015 at 11:02:04AM -0400, Richard Hipp wrote:
> On 8/10/15, Felipe Gasper  wrote:
> > Does SQLite need to have nothing at all to do with fork()? Even when
> > the fork() immediately precedes an exec(), and the exec()ed command has
> > nothing to do with SQLite?
> >
> > Or is it only a problem if the child process *uses* SQLite?
> >
> 
> I think it is only a problem if the child process tries to use SQLite.

If SQLite3 doesn't use pthread_atfork() nor getpid() to detect forks
then that should be the case, though it could also be the case that only
one of the parent or child can continue to use SQLite3 after a fork().
(The latter can be useful for "detaching" daemons, but is a bad pattern.
It's best to do the setup work in the child and signal the parent via a
pipe when the child is ready.)

Nico
--