Repository: qpid-dispatch Updated Branches: refs/heads/master 141a1e383 -> 66ac8672f
DISPATCH-619 - Added use of memalign for Sun/Solaris (rather than posix_memalign). Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/66ac8672 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/66ac8672 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/66ac8672 Branch: refs/heads/master Commit: 66ac8672f1c0d90eb3fdc09526b9fe892a267f03 Parents: 141a1e3 Author: Ted Ross <[email protected]> Authored: Wed Mar 22 16:02:40 2017 -0400 Committer: Ted Ross <[email protected]> Committed: Wed Mar 22 16:02:40 2017 -0400 ---------------------------------------------------------------------- include/qpid/dispatch/ctools.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/66ac8672/include/qpid/dispatch/ctools.h ---------------------------------------------------------------------- diff --git a/include/qpid/dispatch/ctools.h b/include/qpid/dispatch/ctools.h index 1b5d0d3..355f3d3 100644 --- a/include/qpid/dispatch/ctools.h +++ b/include/qpid/dispatch/ctools.h @@ -37,6 +37,20 @@ // If available, use aligned_alloc for cache-line-aligned allocations. Otherwise // fall back to plain malloc. // + +#ifdef __sun +#define NEW_CACHE_ALIGNED(t,p) \ +do { \ + p = memalign(64, sizeof(t) + (sizeof(t) % 64 ? 64 - (sizeof(t) % 64) : 0)); \ +} while (0) + +#define ALLOC_CACHE_ALIGNED(s,p) \ +do { \ + p = memalign(64, s + (s % 64 ? 64 - (s % 64) : 0)); \ +} while (0) + + +#else #define NEW_CACHE_ALIGNED(t,p) \ do { \ if (posix_memalign((void*) &(p), 64, (sizeof(t) + (sizeof(t) % 64 ? 64 - (sizeof(t) % 64) : 0))) != 0) (p) = 0; \ @@ -46,6 +60,7 @@ do { \ do { \ if (posix_memalign((void*) &(p), 64, (s + (s % 64 ? 64 - (s % 64) : 0))) != 0) (p) = 0; \ } while (0) +#endif #define ZERO(p) memset(p, 0, sizeof(*p)) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
