>>> On 10/14/2007 at 5:18 PM, in message
<[EMAIL PROTECTED]>, "Lucian Adrian
Grijincu" <[EMAIL PROTECTED]> wrote:
> OK, I've attached a patch, but I really feel awkward submitting a
> patch for something:
> a) I haven't compiled
> b) I haven't tested
> c) I have no experience working with it
> d) I couldn't find any useful information about on Google/Koders
> (apparently apr, apache MPM and a "gthr" project are the only known
> open source projects that use some of these functions).
> 
> I hope this is the most blindfolded patch you'll ever see from me.
> 
> BTW, is there fear of goto amongst APR devs? I've gotten used to the
> Linux kernel coding style and use it where I see fit. I've seen it is
> used in some places inside APR, but if you don't like it I'll clean it
> up and resubmit (I haven't found on
> http://httpd.apache.org/dev/styleguide.html any goto related
> reference).
> 

The patch doesn't actually do much to simplify the code.  NXContextAlloc() 
simply allocates the environment for the thread to run.  If it fails, the only 
real error message is that there wasn't enough memory. While this seems 
significant, it will be picked up later in the call to NXThreadCreate() which 
will produce the real error that we want to pass back to the caller.  
NXContextSetName() just gives a name to the thread mainly for debugging 
purposes.  Whether it succeeds or fails has no impact on the thread execution.  
Finally, NXThreadCreate() is the real guts of the whole thing and the error 
code that is returned from it, is really what the caller is interested in.  
Finally, since the thread context was allocated as NX_CTX_NORMAL, the internal 
thread management will automatically take care of cleaning up the context if 
NXThreadCreate() fails.  So even though this function could be coded slightly 
more efficiently, in the end there isn't any real gain from doing so. 

Brad

Brad

Reply via email to