If you're doing multi-threaded builds with GCC, the following performance hack 
can help a great deal.

#ifdef _GNU_SOURCE
int gnu_builtin_sync(int *pointer, int amount, int type, const char *file,  int 
line)
{
  int ret;

  if (amount > 0)
    ret = __sync_add_and_fetch(pointer, amount);
  else if (amount < 0)
  {
    int diff = abs(amount);
    ret = __sync_sub_and_fetch(pointer, diff);
  }
  else
    ret = *pointer;

  return ret;
}
#endif

Then when you set up your locking, do this:
                CRYPTO_set_add_lock_callback(gnu_builtin_sync);

--
Principal Security Engineer
Akamai Technologies, Cambridge MA
IM: rs...@jabber.me<mailto:rs...@jabber.me> Twitter: RichSalz

Reply via email to