mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-08 13:01:17 +00:00
their cost by about a factor of 20, which fixes the performance probs observed with Opera. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@121
20 lines
400 B
C
20 lines
400 B
C
|
|
#include <stdio.h>
|
|
#include <assert.h>
|
|
#include <pthread.h>
|
|
|
|
int main ( void )
|
|
{
|
|
const int n = 100000;
|
|
int i, r;
|
|
pthread_mutex_t mx = PTHREAD_MUTEX_INITIALIZER;
|
|
printf("begin %d lock--unlocks\n", n);
|
|
for (i = 0; i < n; i++) {
|
|
r = pthread_mutex_lock(&mx);
|
|
r |= pthread_mutex_unlock(&mx);
|
|
assert(r == 0);
|
|
}
|
|
printf("done %d lock--unlocks\n", n);
|
|
return 0;
|
|
}
|