Use of alloca function

The library call "gethrtime()" and the type "hrtime_t" are Solaris features. IIRC they're in "time.h". I used them because I was on Solaris at the time and they provide nanosecond resolution. The drawback of gethrtime() is that it has no reference frame so it's only a relative time - the value returned by gethrtime() is only meaningful when compared to the value from another call to gethrtime(), and then probably only from within the same process.

It's great for timing durations within a process but that's about it.

Yes, we know this. It's stack memory. It has the same limitation as all local variables.

I have yet to find anything which defines it as threadsafe. One of the major issues with the switch to multithreaded apache versus multiprocess apache was the thread-safety of malloc in its plugins like PHP, which is guaranteed under Windows of all things but not UNIX. Lots of people were concerned, though the issue kind of failed to destroy the world as we know it, much like this other one. :wink:

Actually, the relevant standards and specifications generally declare all APIs to be threadsafe except for a specified set which may (or may not) be threadsafe. For example, see POSIX.1-2008 S2.9.1 General Information

Cancellation points and async-cancel safety are a whole different issue and are not nearly as small a set of specified APIs.

Surprising that the maintainer of the Unix standards opengroup.org doesnt even have an entry for alloca.

Will you please stop harping on it? We know it's not a POSIX function already. That doesn't mean it's not portable.