ghalliday/HPCC-Platform — comment on commit c5e3fc22f26dafe654f7bbafacaa9f415e4f1ed1
File: roxie/roxiemem/roxiemem.cpp line 2110
By ghalliday:

I'll add
//Use atomic_cas so that only one thread can increase the number of pages at a time.
//(Don't use atomic_add because we need to check the limit hasn't been exceeded.)

It could use atomic_add for the !pageLimit case. In fact it might be more efficient as

if (totalPages <= pageLimit)
{
//Use atomic_cas so that only one thread can increase the number of pages at a time.
//(Don't use atomic_add because we need to check the limit hasn't been exceeded.)
if (!atomic_cas(&totalHeapPages, numHeapPages + numRequested, numHeapPages))
continue;
break;
}
else if (!pageLimit)
{
atomic_add(&totalHeapPages, numRequested);
break;
}