lkml.org 
[lkml]   [2005]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Priority Lists for the RT mutex
Daniel Walker wrote:
>
> Description:
> This patch adds the priority list data structure from Inaky Perez-Gonzalez
> to the Preempt Real-Time mutex.
>
> ...
>
> +#define plist_for_each(pos1, pos2, head) \
> + list_for_each_entry(pos1, &((head)->dp_node), dp_node) \
> + list_for_each_entry(pos2, &((pos1)->sp_node), sp_node)

I can't understand how this can work.

The fist list_for_each_entry(->dp_node) will iterate over nodes
with different priorities, ok. But the second one will skip the
first node (which starts new priority group), because list_for_each(head)
does not count head.

To be sure, I wrote simple test:

#include <stdio.h>
#include <limits.h>
#include "list.h"
#include "plist.h"

int main(void)
{
struct plist head, node, *pos1, *pos2;

plist_init(&head, 0);
plist_init(&node, 0);

plist_add(&node, &head);

plist_for_each(pos1, pos2, &head)
printf("Strange ???\n");

return 0;
}

Prints nothing.

My apologies if I'm misunderstanding something.

Oleg.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-05-06 11:01    [W:0.064 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site