the best form to wait the finish of execution of a child...

Michael C. Shultz ringworm01 at gmail.com
Wed Mar 30 10:25:59 PST 2005


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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to
> "freebsd-hackers-unsubscribe at 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


More information about the freebsd-hackers mailing list