- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
looking for a sync method between 2 methods,does this code work?
I am afraid they have some problems :posted here:
http://software.intel.com/en-us/forums/showthread.php?t=76999&o=d&s=lr
any one know peterson lock or lamport barkey lock? they are fit for this situation?
3. any fast sync method in TBB (for only 2 threads)? can be faster than spin_mutex,etc?
I am afraid they have some problems :posted here:
http://software.intel.com/en-us/forums/showthread.php?t=76999&o=d&s=lr
void deActivateFD() //thread 1
{
uint32_t flg = (uint32_t) atomic_read( &fdActive );
if(flg == 0)
return;
if( emptySock() ) //read all buf from sock
atomic_set(&fdActive,0);
}
void activateFD() //thread2
{
uint32_t flg = (uint32_t) atomic_read( &fdActive );
if(flg == 1)
return;
bool tmpFdActive = fillSock()//write something to socket
if(tmpFdActive)
atomic_set(&fdActive,1);
}
2.any one know peterson lock or lamport barkey lock? they are fit for this situation?
3. any fast sync method in TBB (for only 2 threads)? can be faster than spin_mutex,etc?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting softarts
looking for a sync method between 2 methods,does this code work?
It definitely works. However we can't answer as to whether it works the way you want or not, because we don't know what you want to achieve.

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