I am currently developing an application using Intel Haswell RTM (Hardware support for transactional memory). From what I could see here and here, the recommended procedure is to use a fallback lock of some kind, in case the transaction aborts.
The recommended flow is the following:
someTypeOfLock fallback_lock;
if(_xbegin == _XBEGIN_STARTED) {
if(fallback_lock.isLocked()) // put the lock into the transaction read_set
_xabort();
// do stuff
_xend();
}
else{
fallback_lock.acquire();
// do stuff
fallback_lock.release();
}
My question is with the isLocked() function. Until now I didn't find any mainstream library/class which provide this functionality (which, as seen here, is most of the time useless). Do you have any recommendations?
Thanks!