ms-queue: fixup initialization and free lists
authorBrian Norris <banorris@uci.edu>
Fri, 8 Mar 2013 23:36:20 +0000 (15:36 -0800)
committerBrian Norris <banorris@uci.edu>
Fri, 8 Mar 2013 23:46:33 +0000 (15:46 -0800)
commit4cd598105d4f196946bb15068ec4be2dc6c691bc
tree9c35436ca2c5dcb5f7db39cf5038d3b85590e91c
parente43fa1946c2a733400040cc9d23e91285fd08fd0
ms-queue: fixup initialization and free lists

There are a few things we fix:

1) We shouldn't initialize node[0].next, since node[0] is the 'NULL'
pointer and should never be accessed.

2) The per-thread free list is too restrictive. Now, we generate a list
of free nodes for each thread that can contain up to 4 node indexes.
We only initialize this list with 2 nodes each (so each thread can
expand its free list, if needed). There is some minimal assertion
framework and race detection performed on these lists, just in case.

3) We only initialize those nodes that are placed in the free list.
Accesses to other nodes' 'next' pointer should trigger an uninitialized
loads assertion.
ms-queue/my_queue.c