incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farid Zaripov" <Far...@kyiv.vdiweb.com>
Subject RE: string methods thread safety
Date Fri, 21 Jul 2006 09:21:28 GMT
> -----Original Message-----
> From: Martin Sebor [mailto:sebor@roguewave.com] 
> Sent: Friday, July 21, 2006 3:34 AM
> To: stdcxx-dev@incubator.apache.org
> Subject: Re: string methods thread safety
> 
> > // returns pid of the created process
> > // returns -1 if failed
> > // note: argv[0] should be equal to path
> > _TEST_EXPORT rw_pid_t 
> > rw_process_create (const char* path, char* const argv []);
> 
> I'm not sure about the second argument. Is it the most 
> convenient interface?
  I just copied the interface from execv function. This interface is
useful when execute self copy
to prevent unnecessary translation of the array argv[] to the array of
char.

> Wouldn't something closer to 
> rw_system() be easier to use? (If so, you might want to move 
> rw_process_create to the .cpp file and make it static and 
> call it from the new vararg function).
  Since rw_process_create just calls execv() after fork() I think that
it will be useful create a full set
of functions rw_process_createxx similar to a set of functions execxx.
Plus the function
rw_create_process (without suffixes) with the interface like
rw_system().

> > +    // the child process
> > +    execv (path, argv);
> > +
> > +    // the execvp returns only if an error occurs
> > +    rw_fatal (0, __FILE__, __LINE__, "execvp failed: : 
> errno = %{#m} 
> > + (%{m})");
> > +
> > +    exit (1);
> 
> FYI: rw_fatal() doesn't return so there's no need to call exit().
> 
> I'm not sure rw_fatal() is appropriate, though. The test 
> might be able to continue with other things after a failure.
  I think in that case the test shouldn't to continue because after a
fork() succeeded
it will be a copy of the parent process. What for to continue a child
copy?

Farid.

Mime
View raw message