How _xabort(status) in HTM works?

171 Views Asked by At

I used _xabort(status) function in my code, in order to release the buffer in cache. I check the transaction whether it's successful, if the transaction success, I use _xend(), otherwise I use _xabort(status). Can I use the _xabort(status) in this situation?

unsigned status = 0;
while(true)
{
    status = _xbegin();
    if(status == _XBEGIN_STARTED)
    {
         //Transaction code
         bool success = transaction_func();
         if(success)
         {
             _xend();
             break;
         }
         else
         {
             _xabort(0Xff);
             continue;
         }
    }
}

Can I use the _xabort(status) like this? it's a single thread situation, I check the transaction_func() by myself, and call _xabort(status). I think it's a issue about usage of _xabort(status), I don't know whether it can remain in (status == _XBEGIN_STARTED) area. In my opinion, if the status equals _XBEGIN_STARTED, it will not abort the transaction, so this code is not right?

If transction_func() return false, printf the status in this code, why the status value is '0xff000001'?

0

There are 0 best solutions below