apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel May <Dan...@spryware.com>
Subject RE: Does apr_atomic_inc64 exist ?
Date Wed, 07 Jan 2009 23:44:03 GMT
What is the APR standard for utilizing functions that may or may not be present in a specific
version of an OS ?
For example, there are two ways, at run time, to detect the presence of InterlockedIncrement64()
under Windows.

A. You could call a LoadLibrary/GetProcAddress combination on the function, and use it if
you succeed in getting a valid function pointer.
B. You can make Kernel32.dll delayload, and only attempt to call InterlockedIncrement64()
if the proper OS version is detected at run time that is known to support InterlockedIncrement64().

I guess the same can be done for processor specific features at run time.


-----Original Message-----
From: Jim Jagielski [mailto:jim@jaguNET.com]
Sent: Wednesday, January 07, 2009 7:46 AM
To: Justin Erenkrantz
Cc: Daniel May; dev@apr.apache.org
Subject: Re: Does apr_atomic_inc64 exist ?

On Jan 6, 2009, at 12:50 PM, Justin Erenkrantz wrote:

> On Tue, Jan 6, 2009 at 7:17 AM, Daniel May <Daniel@spryware.com>
> wrote:
>> I am looking for a 64-bit counterpart to apr_atomic_inc32().  Has
>> this been implemented ?
> I don't believe that we've guaranteed 64-bit atomics anywhere.  I'm
> not sure how much underlying OS/architecture support there would
> generically be for 64-bit atomics...   -- justin

Unless we do it with mutexes... ugly. But we do have places
in the code where the lack of 64bit "atomics" are a concern...

PS: Am I the only one who, when I see "atomics" think of Patrick
     Stewart in the old Dune movie screaming: "Atomics!" ??

View raw message