------art_17994_8154745.1197061416452
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Dec 7, 2007 12:33 PM, James Gray <james / grayproductions.net> wrote:

> I'm not saying this is wrong, just clarifying what I am seeing.  Is it
> intended that at_exit() handlers are inherited by a fork()ed process?
> For example:
>
>   at_exit { puts "Doing something important for #{Process.pid}." }
>   fork


Makes sense to me.

#include<stdlib.h>
#include<sys/types.h>
#include<unistd.h>
#include<stdio.h>

static void handler() {
    printf("handler for pid %d\n",getpid());
}

int main() {
    atexit(handler);
    if(fork()) wait(0);
    return 0;
}

-Adam

------art_17994_8154745.1197061416452--