* src/threads/lock.cpp (sable_flc_waiting): Slight optimization, avoiding
[cacao.git] / tests / threads / sableContention.patch
1 --- a/src/threads/lock.cpp      Thu Sep 11 14:52:50 2008 +0200
2 +++ b/src/threads/lock.cpp      Thu Sep 11 15:13:24 2008 +0200
3 @@ -717,6 +717,7 @@
4                 for (;;)
5                 {
6                         threadobject *current;
7 +                       int i = 0;
8  
9                         // Wait until another thread sees the flc bit and notifies
10                         // us of unlocking.
11 @@ -726,8 +727,17 @@
12                                 break;
13                         /* Traverse FLC list looking if we're still there */
14                         current = t_other->flc_list;
15 -                       while (current && current != t)
16 +                       while (current && current != t) {
17 +                               i++;
18                                 current = current->flc_next;
19 +                       }
20 +                       {
21 +                               static int umax = 0;
22 +                               if (i>umax) {
23 +                                       printf("sable len %d\n", i);
24 +                                       umax = i;
25 +                               }
26 +                       }
27                         if (!current)
28                                 /* not in list anymore, can stop waiting */
29                                 break;