unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Nala Ginrut <nalaginrut@gmail.com>
To: Andy Wingo <wingo@pobox.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: wip-threads-and-fork
Date: Sat, 25 Feb 2012 10:21:54 +0800	[thread overview]
Message-ID: <CAPjoZofeqmM56wjabUH5x14NF5PHB7yPOkHSxMCcmZBrbffuAg@mail.gmail.com> (raw)
In-Reply-To: <878vjskqk7.fsf@pobox.com>

[-- Attachment #1: Type: text/plain, Size: 1770 bytes --]

On Sat, Feb 25, 2012 at 2:57 AM, Andy Wingo <wingo@pobox.com> wrote:

> Hello :)
>
> On Fri 24 Feb 2012 04:00, Nala Ginrut <nalaginrut@gmail.com> writes:
>
> > I think I could use pipes to handle some sub-process rather than do it
> > with fork manually. But I must create a daemon, it can't avoid to use
> > fork, will this circumstance cause problems if I use threads after it?
>
> Hummm.  Very good question.  I started to answer this, but ended up
> committing the hack I mailed before, then found this reply now.
>
> Basically, if you try to daemonize with fork, you would need to do it
> very early, before your program makes any threads.  In master, Guile now
> enforces that condition.
>
>
So, this suggestion implies primitive-fork would be kept?


> Note that the first time your program calls `sigaction', Guile spawns a
> thread to handle signals.  You'd need to fork before installing signal
> handlers.
>
>
Fortunately. ;-)


> Another thing to think about is libgc.  In the "master" branch, libgc
> itself can spawn threads -- for example, a thread for doing parallel
> marking.
>
> There is a tension here between making things work, and making them
> correct.  It is possible to get fork + threads mostly working on glibc
> platforms -- for example, we could restart signal-handling and finalizer
> threads in primitive-fork.  But it is not possible to make the use of
> `primitive-fork' correct, in general, in the presence of threads.
>
>
I think all I need primitive-fork is just to daemonize, and I can try to do
it in the very early.
Moreover, primitive-fork would be restricted to be used for daemon to
anybody.
Considering this point, why not add a "daemonize" proc instead of
"primitive-fork"?


> Cheers,
>
> Andy
> --
> http://wingolog.org/
>

[-- Attachment #2: Type: text/html, Size: 2857 bytes --]

  reply	other threads:[~2012-02-25  2:21 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-08 22:10 wip-threads-and-fork Andy Wingo
2012-02-22 21:40 ` wip-threads-and-fork Andy Wingo
2012-02-23 15:05   ` wip-threads-and-fork Andy Wingo
2012-02-23 15:49     ` wip-threads-and-fork Nala Ginrut
2012-02-23 16:13       ` wip-threads-and-fork Andy Wingo
2012-02-24  3:00         ` wip-threads-and-fork Nala Ginrut
2012-02-24 10:21           ` wip-threads-and-fork Andy Wingo
2012-02-24 14:08             ` wip-threads-and-fork Nala Ginrut
2012-02-24 14:47               ` wip-threads-and-fork Andy Wingo
2012-02-24 15:25                 ` wip-threads-and-fork Nala Ginrut
2012-02-26 22:03             ` wip-threads-and-fork Ludovic Courtès
2012-02-27  9:44               ` wip-threads-and-fork Andy Wingo
2012-03-01 19:40                 ` wip-threads-and-fork Ludovic Courtès
2012-02-24 18:57           ` wip-threads-and-fork Andy Wingo
2012-02-25  2:21             ` Nala Ginrut [this message]
2012-02-25  2:30               ` wip-threads-and-fork Nala Ginrut
2012-02-25 18:01                 ` wip-threads-and-fork Andy Wingo
2012-02-26  2:35                   ` wip-threads-and-fork Nala Ginrut
2012-02-26 22:00     ` wip-threads-and-fork Ludovic Courtès
2012-02-27  9:39       ` wip-threads-and-fork Andy Wingo
2012-03-01 19:35         ` wip-threads-and-fork Ludovic Courtès
2012-03-03 16:32           ` wip-threads-and-fork Andy Wingo
2012-03-03 21:20             ` wip-threads-and-fork Ludovic Courtès
2012-03-04 11:38               ` wip-threads-and-fork Andy Wingo
2012-03-21 21:26                 ` wip-threads-and-fork Ludovic Courtès
2012-03-22  2:48                   ` wip-threads-and-fork Nala Ginrut
2012-03-23  9:40                   ` wip-threads-and-fork Andy Wingo
2012-03-27 15:54                     ` wip-threads-and-fork Ludovic Courtès
2012-04-06 18:30                       ` wip-threads-and-fork Andy Wingo
2012-04-07 22:54                         ` wip-threads-and-fork Ludovic Courtès
2013-01-17 11:41                           ` wip-threads-and-fork Andy Wingo
2012-03-01 19:32 ` wip-threads-and-fork Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPjoZofeqmM56wjabUH5x14NF5PHB7yPOkHSxMCcmZBrbffuAg@mail.gmail.com \
    --to=nalaginrut@gmail.com \
    --cc=guile-devel@gnu.org \
    --cc=wingo@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).