Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

question on memory fence

softarts
Beginner
114 Views

take Compare and Swap as en example:

free(coid * newhead)

do

{

oldhead = next;

newhead->next = next;

//asm volatile("mfence":::"memory");

}while(!CAS(&next,oldhead,(void*)newhead));

'next' is the freelist's head,the function will put 'next' point to newhead, and nexhead->next point to original next,butI found sometimes newhead->next doesn't update with 'next'

is it relevant to memory fence?

BTW, I only tested it with gcc

0 Kudos
0 Replies
Reply