Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Mar 2005 10:25:57 -0800
From:      "Michael C. Shultz" <ringworm01@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   Re: the best form to wait the finish of execution of a child...
Message-ID:  <200503301025.57363.ringworm01@gmail.com>
In-Reply-To: <a9e342b5050330101771e53d6f@mail.gmail.com>
References:  <a9e342b5050330101771e53d6f@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 30 March 2005 10:17 am, zean zean wrote:
> Hi Hackers:
>
> Excuse for my badly English.  which is the best form to wait  the
> finish of execution of a child.
>
> My idea is:
>
> pid_t chilpid;
>
> while(childpid != wait(&status))
> ;
>
> Any aid to obtain the best way is very welcome.
>
> PD. Excuse my ignorance and I hope they can guide me.
>
> Bye and thanxs ;)
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to
> "freebsd-hackers-unsubscribe@freebsd.org"

Here is how I do it, likely someone will have a better way:

	pid_t		pid;

	pid	= fork();
	if( !pid )
	{
		execl( "/bin/mkdir", "mkdir", "directory_name", 0 );
	}
	wait( (int*)pid );

-Mike



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200503301025.57363.ringworm01>