Infinite loop not working DMD2

Brad Roberts braddr at puremagic.com
Thu Jun 2 08:42:56 PDT 2011


On 6/2/2011 8:43 AM, Guillermo Estrada wrote:
> Hi, been developing in D a lot but first time in news groups, I
> thought this might be the place.
> 
> I'm trying to make a fork bomb in D (of course no fork cause target
> its windows platform) but anyway. I did one a while ago using D1 and
> Tango and all ran perfectly, I'm trying to migrate my whole dev to
> D2 and Phobos (reading Andrei's book) but this one does not work.
> 
> import std.process;
> 
> void main(string[] args) {
> 	while( true ) {
> 		execv(args[0], null);
> 	}
> }
> 
> It spawns one after the other but just once, it always exits the
> father process, if u comment the execv line, program stays in the
> infinite loop as expected. any insight?

The exec* family of functions cause the new app to replace the current process.  So after the execv, the loop doesn't exist.


More information about the Digitalmars-d-learn mailing list