- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page