bitops or mutex

2013-01-21 Thread Prashant Shah
Hi, There is a bitmap that needs to be locked across many threads for test / set bit operations. Which one is faster - bitops or mutex ? 1. Bitops : set_bit(5, (long unsigned *)tmp); 2. Mutex : mutex_lock(m); *tmp = (*tmp) | (1 5); mutex_unlock(m); Regards

Re: bitops or mutex

2013-01-21 Thread Valdis . Kletnieks
On Mon, 21 Jan 2013 19:16:47 +0530, Prashant Shah said: There is a bitmap that needs to be locked across many threads for test / set bit operations. Which one is faster - bitops or mutex ? 1. Bitops : set_bit(5, (long unsigned *)tmp); 2. Mutex : mutex_lock(m); *tmp = (*tmp) | (1 5