Use the recursive set allocator for mightsee.

This completely removes the lock used to protect the set allocation code
while keeping the use of the set api clean.
This commit is contained in:
Bill Currie 2013-03-18 13:30:50 +09:00
parent 247f3be0c0
commit 1c20a49dba
3 changed files with 7 additions and 6 deletions

View file

@ -75,15 +75,13 @@ CheckStack (cluster_t *cluster, threaddata_t *thread)
}
static pstack_t *
new_stack (void)
new_stack (threaddata_t *td)
{
pstack_t *stack;
stack = malloc (sizeof (pstack_t));
stack->next = 0;
LOCK;
stack->mightsee = set_new_size (portalclusters);
UNLOCK;
stack->mightsee = set_new_size_r (&td->set_pool, portalclusters);
return stack;
}
@ -286,7 +284,7 @@ RecursiveClusterFlow (int clusternum, threaddata_t *thread, pstack_t *prevstack)
thread->stats.chains++;
if (!prevstack->next)
prevstack->next = new_stack ();
prevstack->next = new_stack (thread);
stack = prevstack->next;
stack->cluster = 0;
@ -465,9 +463,10 @@ PortalFlow (threaddata_t *data, portal_t *portal)
if (portal->status != stat_selected)
Sys_Error ("PortalFlow: reflowed");
portal->status = stat_working;
portal->visbits = set_new_size (portalclusters);
UNLOCK;
portal->visbits = set_new_size_r (&data->set_pool, portalclusters);
data->clustervis = portal->visbits;
data->base = portal;

View file

@ -363,6 +363,7 @@ LeafThread (void *_thread)
threaddata_t data;
memset (&data, 0, sizeof (data));
set_pool_init (&data.set_pool);
do {
portal = GetNextPortal ();
if (!portal)