Example #1
0
void FF_Controller::Mark_Unit_Not_Busy(Flash_Address flash_address)
{
 	// Check to see if the unit_index is busy.
	// For the HBC, only one device can be accessed at one time.
	U32 unit_index = flash_address.Unit_Index();
	CT_ASSERT(unit_index < Flash_Address::Num_Units(), FF_Controller::Mark_Unit_Not_Busy);

	CT_ASSERT(FF_Controller::m_p_controller_context[unit_index], 
		FF_Controller::Mark_Unit_Not_Busy);
	
	// Set callback context for this unit_index to null because it is
	// no longer busy.
	m_p_controller_context[unit_index] = 0;
		
	if (m_can_units_overlap)
	{
		// See if another context is waiting for this unit_index.
		if (!LIST_IS_EMPTY(&m_context_list_wait_unit[unit_index]))
		{
			m_p_flash->m_stats.Dec_Num_Waits_Unit(unit_index);

			FF_Controller_Context *p_controller_context;
			p_controller_context = (FF_Controller_Context *)LIST_REMOVE_HEAD(
				&m_context_list_wait_unit[unit_index]);
			
 			TRACEF(TRACE_L5, 
				(EOL "Mark_Unit_Not_Busy Making context ready for unit_index = %d", 
				p_controller_context->m_flash_address.Unit_Index()));
 		
			// Queue context back on ready list for execution.
			p_controller_context->Make_Ready();
		}
	} // m_can_units_overlap

	else
	{
		// See if another context is waiting for any unit.
		U32 num_units = Flash_Address::Num_Units();
		for (U32 any_unit_index = 0; any_unit_index < num_units; any_unit_index++)
		{
			if (!LIST_IS_EMPTY(&m_context_list_wait_unit[any_unit_index]))
			{
				m_p_flash->m_stats.Dec_Num_Waits_Unit(any_unit_index);

				FF_Controller_Context *p_controller_context;
				p_controller_context = (FF_Controller_Context *)LIST_REMOVE_HEAD(
					&m_context_list_wait_unit[any_unit_index]);
				
 				TRACEF(TRACE_L5, 
					(EOL "Mark_Unit_Not_Busy Making context ready for unit_index = %d", 
					p_controller_context->m_flash_address.Unit_Index()));
 			
				// Queue context back on ready list for execution.
				p_controller_context->Make_Ready();
				return;
			}
		}
	} // NOT m_can_units_overlap
		
} // FF_Controller::Mark_Unit_Not_Busy
Example #2
0
File: cpp.c Project: rui314/8cc-old
/*
 * Substitutes parameters in macro definition body with actual arguments.
 */
static List *subst(CppContext *ctx, Macro *macro, List *args, List *hideset) {
    List *r = make_list();
    for (int i = 0; i < LIST_LEN(macro->body); i++) {
        bool islast = (i == LIST_LEN(macro->body) - 1);
        Token *t0 = LIST_REF(macro->body, i);
        Token *t1 = islast ? NULL : LIST_REF(macro->body, i + 1);
        bool t0_param = t0->toktype == TOKTYPE_MACRO_PARAM;
        bool t1_param = !islast && t1->toktype == TOKTYPE_MACRO_PARAM;

        if (is_punct(t0, '#') && t1_param) {
            list_push(r, stringize(t0, LIST_REF(args, t1->val.i)));
            i++;
            continue;
        }
        if (is_punct(t0, KEYWORD_TWOSHARPS) && t1_param) {
            List *arg = LIST_REF(args, t1->val.i);
            if (!LIST_IS_EMPTY(arg)) {
                glue_push(r, (Token *)LIST_REF(arg, 0));
                List *tmp = make_list();
                for (int i = 1; i < LIST_LEN(arg); i++)
                    list_push(tmp, LIST_REF(arg, i));
                list_append(r, expand_all(ctx, tmp));
            }
            i++;
            continue;
        }
        if (is_punct(t0, KEYWORD_TWOSHARPS) && !islast) {
            hideset = t1->hideset; // wrong?
            glue_push(r, t1);
            i++;
            continue;
        }
        if (t0_param && !islast && is_punct(t1, KEYWORD_TWOSHARPS)) {
            hideset = t1->hideset; // wrong?
            List *arg = LIST_REF(args, t0->val.i);
            if (LIST_IS_EMPTY(arg))
                i++;
            else
                list_append(r, arg);
            continue;
        }
        if (t0_param) {
            List *arg = LIST_REF(args, t0->val.i);
            list_append(r, expand_all(ctx, arg));
            continue;
        }
        list_push(r, t0);
    }
    return add_hide_set(r, hideset);
}
static INLINE void
svga_screen_cache_add(struct svga_screen *svgascreen,
                      const struct svga_host_surface_cache_key *key, 
                      struct svga_winsys_surface **p_handle)
{
   struct svga_host_surface_cache *cache = &svgascreen->cache;
   struct svga_winsys_screen *sws = svgascreen->sws;
   struct svga_host_surface_cache_entry *entry = NULL;
   struct svga_winsys_surface *handle = *p_handle;
   
   assert(key->cachable);

   assert(handle);
   if(!handle)
      return;
   
   *p_handle = NULL;
   pipe_mutex_lock(cache->mutex);
   
   if(!LIST_IS_EMPTY(&cache->empty)) {
      /* use the first empty entry */
      entry = LIST_ENTRY(struct svga_host_surface_cache_entry, cache->empty.next, head);
        
      LIST_DEL(&entry->head);
   }
Example #4
0
File: cpp.c Project: rui314/8cc-old
/*
 * Reads a file name of #include directive.  If the file name is quoted with <>,
 * "std" will set to true.  If quoted with doublequote, set to false.  We use
 * expand_one() rather than read_cpp_token(), because macros are allowed to be
 * used in #include.
 * (C99 6.10.2 Source file inclusion)
 */
static void read_cpp_header_name(CppContext *ctx, String **name, bool *std) {
    if (LIST_IS_EMPTY(ctx->ungotten)) {
        *name = read_header_name(ctx, std);
        if (name)
            return;
    }

    Token *tok = expand_one(ctx);
    if (!tok || tok->toktype == TOKTYPE_NEWLINE)
        error_token(tok, "expected file name, but got '%s'", token_to_string(tok));
    if (tok->toktype == TOKTYPE_STRING) {
        *name = tok->val.str;
        *std = false;
        return;
    }
    List *tokens = make_list();
    if (is_punct(tok, '<')) {
        for (;;) {
            Token *tok = expand_one(ctx);
            if (!tok || tok->toktype == TOKTYPE_NEWLINE)
                error_token(tok, "premature end of header name");
            if (is_punct(tok, '>'))
                break;
            list_push(tokens, tok);
        }
        *name = join_tokens(tokens, false);
        *std = true;
        return;
    }
    error_token(tok, "'<' expected, but got '%s'", token_to_string(tok));
}
Example #5
0
/* Frees older cached buffers.  Called under table_lock */
void fd_cleanup_bo_cache(struct fd_device *dev, time_t time)
{
	int i;

	if (dev->time == time)
		return;

	for (i = 0; i < dev->num_buckets; i++) {
		struct fd_bo_bucket *bucket = &dev->cache_bucket[i];
		struct fd_bo *bo;

		while (!LIST_IS_EMPTY(&bucket->list)) {
			bo = LIST_ENTRY(struct fd_bo, bucket->list.next, list);

			/* keep things in cache for at least 1 second: */
			if (time && ((time - bo->free_time) <= 1))
				break;

			list_del(&bo->list);
			bo_del(bo);
		}
	}

	dev->time = time;
}
Example #6
0
event_group_element_type synchronize_event_group_try_wait_for_any( event_group_type _group )
{
    synchronize_event_group* group = _group;
    list_iterator iter;
    synchronize_event_group_element* element = NULL;
    synchronize_event_group_element* active_element = NULL;
    pthread_mutex_lock( &(group->mutex) );
    if ( LIST_IS_EMPTY( &group->elements ) )
    {
        pthread_mutex_unlock( &(group->mutex) );
        return NULL;
    }
    LIST_ITERATOR_START( iter, &group->elements );
    while ( LIST_ITERATOR_IS_VALID(iter) )
    {
        element = *(synchronize_event_group_element**)LIST_ITERATOR_GET(iter);
        if ( element->flag )
        {
            active_element = element;
            active_element->flag = FALSE;
            break;
        }
        LIST_ITERATOR_NEXT(iter);
    }
    pthread_mutex_unlock( &(group->mutex) );
    return active_element;
}
Example #7
0
void synchronize_event_group_wait_for_all( event_group_type _group )
{
    synchronize_event_group* group = _group;
    list_iterator iter;
    synchronize_event_group_element* element = NULL;
    pthread_mutex_lock( &(group->mutex) );
    do
    {
        if ( LIST_IS_EMPTY( &group->elements ) )
        {
            pthread_mutex_unlock( &(group->mutex) );
            return;
        }
        LIST_ITERATOR_START( iter, &group->elements );
        while ( LIST_ITERATOR_IS_VALID(iter) )
        {
            element = *(synchronize_event_group_element**)LIST_ITERATOR_GET(iter);
            if ( !element->flag )
            {
                pthread_cond_wait( &(group->cond), &(group->mutex) );
                continue;
            }
            LIST_ITERATOR_NEXT(iter);
        }
        LIST_ITERATOR_START( iter, &group->elements );
        while ( LIST_ITERATOR_IS_VALID(iter) )
        {
            element = *(synchronize_event_group_element**)LIST_ITERATOR_GET(iter);
            element->flag = FALSE;
            LIST_ITERATOR_NEXT(iter);
        }
        break;
    } while ( TRUE );
    pthread_mutex_unlock( &(group->mutex) );
}
Example #8
0
/* find a snapshot state that applies to this ewin */
static Snapshot    *
_SnapEwinFind(EWin * ewin)
{
   Snapshot           *sn;

   if (ewin->snap)
      return ewin->snap;

   if (LIST_IS_EMPTY(&ss_list))
      return NULL;

   /* If exec'ed by snap try matching command exactly */
   sn = LIST_FIND(Snapshot, &ss_list, _SnapEwinFindMatchCmd, ewin);
   if (sn && sn->startup_id > 0)
     {
	/* Assuming we were started by snap */
	sn->startup_id = 0;	/* Only the first time */
	ewin->state.snapstarted = 1;
     }

   if (!sn)
      sn = LIST_FIND(Snapshot, &ss_list, _SnapEwinFindMatch, ewin);

   if (sn && !(sn->match_flags & SNAP_MATCH_MULTIPLE))
     {
	sn->used = ewin;
	ewin->snap = sn;
     }

   return sn;
}
Example #9
0
static struct fd_bo *find_in_bucket(struct fd_device *dev,
		struct fd_bo_bucket *bucket, uint32_t flags)
{
	struct fd_bo *bo = NULL;

	/* TODO .. if we had an ALLOC_FOR_RENDER flag like intel, we could
	 * skip the busy check.. if it is only going to be a render target
	 * then we probably don't need to stall..
	 *
	 * NOTE that intel takes ALLOC_FOR_RENDER bo's from the list tail
	 * (MRU, since likely to be in GPU cache), rather than head (LRU)..
	 */
	pthread_mutex_lock(&table_lock);
	while (!LIST_IS_EMPTY(&bucket->list)) {
		bo = LIST_ENTRY(struct fd_bo, bucket->list.next, list);
		if (0 /* TODO: if madvise tells us bo is gone... */) {
			list_del(&bo->list);
			bo_del(bo);
			bo = NULL;
			continue;
		}
		/* TODO check for compatible flags? */
		if (is_idle(bo)) {
			list_del(&bo->list);
			break;
		}
		bo = NULL;
		break;
	}
	pthread_mutex_unlock(&table_lock);

	return bo;
}
Example #10
0
LIST_ENTRY_T *
listGetFrontEntry(LIST_T *list)
{
    if (LIST_IS_EMPTY(list))
        return NULL;

    return list->forw;
}
Example #11
0
LIST_ENTRY_T *
listGetBackEntry(LIST_T *list)
{
    if (LIST_IS_EMPTY(list))
        return NULL;

    return list->back;
}
Example #12
0
File: cpp.c Project: rui314/8cc-old
/*
 * Handles #if, #elif, #ifdef and #ifndef.  If condition does not meet, the
 * function calls skip_cond_include(), defined in lex.c, to skip all tokens
 * until the next #elif, #else of #endif.
 *
 * (C99 6.10.1 Conditional inclusion)
 */
static void handle_cond_incl(CppContext *ctx, CondInclType type) {
    bool cond;
    switch (type) {
    case COND_IF:
        cond = read_constant_expr(ctx);
        break;
    case COND_IFDEF:
        cond = read_ifdef(ctx);
        break;
    case COND_IFNDEF:
        cond = !read_ifdef(ctx);
        break;
    case COND_ELIF:
        error_cpp_ctx(ctx, "stray #elif");
    case COND_ELSE:
        expect_newline(ctx);
        if (LIST_IS_EMPTY(ctx->incl))
            error_cpp_ctx(ctx, "stray #else");
        bool in_else = (intptr)list_pop(ctx->incl);
        if (in_else)
            error_cpp_ctx(ctx, "#else appears twice");
        CondInclType type1 = skip_cond_incl(ctx);
        if (type1 == COND_ELIF)
            error_cpp_ctx(ctx, "stray #elif");
        if (type1 == COND_ELSE)
            error_cpp_ctx(ctx, "stray #else");
        return;
    case COND_ENDIF:
        expect_newline(ctx);
        if (LIST_IS_EMPTY(ctx->incl))
            error_cpp_ctx(ctx, "stray #endif");
        list_pop(ctx->incl);
        return;
    }
    if (cond) {
        list_push(ctx->incl, (void *)false);
        return;
    }
    // skip_cond_incl() returns one of COND_ELIF, COND_ELSE or COND_ENDIF.
    CondInclType type1 = skip_cond_incl(ctx);
    if (type1 == COND_ELIF)
        handle_cond_incl(ctx, COND_IF);
    else if (type1 == COND_ELSE)
        list_push(ctx->incl, (void *)true);
}
void r600_postflush_resume_features(struct r600_common_context *ctx)
{
	if (ctx->streamout.suspended) {
		ctx->streamout.append_bitmask = ctx->streamout.enabled_mask;
		r600_streamout_buffers_dirty(ctx);
	}

	/* resume queries */
	if (!LIST_IS_EMPTY(&ctx->active_queries))
		r600_resume_queries(ctx);
}
Example #14
0
File: cpp.c Project: rui314/8cc-old
Token *read_token(ReadContext *readctx) {
    if (!LIST_IS_EMPTY(readctx->ungotten))
        return list_pop(readctx->ungotten);

    for (;;) {
        Token *tok = read_token_int(readctx->cppctx);
        if (!tok) return NULL;
        if (tok->toktype == TOKTYPE_NEWLINE)
            continue;
        return cpp_token_to_token(tok);
    }
}
Example #15
0
void
NineBuffer9_SetDirty( struct NineBuffer9 *This )
{
    assert(This->base.pool == D3DPOOL_MANAGED);

    if (!This->managed.dirty) {
        assert(LIST_IS_EMPTY(&This->managed.list));
        list_add(&This->managed.list, &This->base.base.device->update_buffers);
        This->managed.dirty = TRUE;
    }
    u_box_1d(0, This->size, &This->managed.dirty_box);
}
void r600_preflush_suspend_features(struct r600_common_context *ctx)
{
	/* suspend queries */
	if (!LIST_IS_EMPTY(&ctx->active_queries))
		r600_suspend_queries(ctx);

	ctx->streamout.suspended = false;
	if (ctx->streamout.begin_emitted) {
		r600_emit_streamout_end(ctx);
		ctx->streamout.suspended = true;
	}
}
Example #17
0
/**
 * Main scheduler routine in RR policy implmentation
 *
 * @param
 * @return next_vcpuid
 */
int sched_rr_do_schedule(uint64_t *expiration)
{
    uint32_t pcpu = smp_processor_id();
    /* TODO:(igkang) change type to bool */
    struct rq_entry_rr *next_entry = NULL;
    bool is_switching_needed = false;
    int next_vcpuid = VCPUID_INVALID;

    /* check pending attach list
     *      then attach them to runqueue_rr */
    /* TODO:(igkang) write code to attach pending attach requests */

    /* TODO:(igkang) improve logical code structure to make it easier to read */
    /* determine next vcpu to be run
     *  - if there is an detach-pending vcpu than detach it. */
    if (current[pcpu] == NULL) { /* No vCPU is running */
        if (!LIST_IS_EMPTY(&runqueue_rr[pcpu])) { /* and there are some vcpus waiting */
            is_switching_needed = true;
        }
    } else { /* There's a vCPU currently running */
        struct rq_entry_rr *current_entry = NULL;
        /* put current entry back to runqueue_rr */
        current_entry = LIST_ENTRY(struct rq_entry_rr, current[pcpu], head);
        LIST_ADDTAIL(current[pcpu], &runqueue_rr[pcpu]);

        /* let's switch as tick is over */
        current_entry->state = WAITING;
        current[pcpu] = NULL;

        is_switching_needed = true;
    }

    /* update scheduling-related data (like tick) */
    if (is_switching_needed) {
        /* move entry from runqueue_rr to current */
        current[pcpu] = runqueue_rr[pcpu].next;
        LIST_DELINIT(current[pcpu]);

        next_entry = LIST_ENTRY(struct rq_entry_rr, current[pcpu], head);

        *expiration =
            timer_get_timenow() + MSEC(1) * (uint64_t) next_entry->tick_reset_val;
    }

    /* vcpu of current entry will be the next vcpu */
    if (current[pcpu] != NULL) {
        next_entry = LIST_ENTRY(struct rq_entry_rr, current[pcpu], head);
        next_entry->state = RUNNING;

        /* set return next_vcpuid value */
        next_vcpuid = next_entry->vcpuid;
    }
Example #18
0
/* listPop()
 *
 * Remove the element from the forw pointer of the
 * list.
 */
LIST_ENTRY_T *
listPop(LIST_T *list)
{
    LIST_ENTRY_T *ent;

    if (LIST_IS_EMPTY(list))
        return NULL;

    ent = list->forw;
    listRemoveEntry(list, ent);

    return ent;
}
Example #19
0
static void
pb_debug_manager_destroy(struct pb_manager *_mgr)
{
   struct pb_debug_manager *mgr = pb_debug_manager(_mgr);
   
   pipe_mutex_lock(mgr->mutex);
   if(!LIST_IS_EMPTY(&mgr->list)) {
      debug_printf("%s: unfreed buffers\n", __FUNCTION__);
      pb_debug_manager_dump(mgr);
   }
   pipe_mutex_unlock(mgr->mutex);
   
   pipe_mutex_destroy(mgr->mutex);
   mgr->provider->destroy(mgr->provider);
   FREE(mgr);
}
DWORD WINAPI
NineBaseTexture9_SetLOD( struct NineBaseTexture9 *This,
                         DWORD LODNew )
{
    DWORD old = This->lod;

    DBG("This=%p LODNew=%d\n", This, LODNew);

    user_assert(This->base.pool == D3DPOOL_MANAGED, 0);

    This->lod = MIN2(LODNew, This->base.info.last_level);

    if (This->lod != old && This->bind_count && LIST_IS_EMPTY(&This->list))
       list_add(&This->list, &This->base.base.device->update_textures);

    return old;
}
Example #21
0
void r600_preflush_suspend_features(struct r600_common_context *ctx)
{
	/* suspend queries */
	if (ctx->num_cs_dw_nontimer_queries_suspend) {
		/* Since non-timer queries are suspended during blits,
		 * we have to guard against double-suspends. */
		r600_suspend_nontimer_queries(ctx);
		ctx->nontimer_queries_suspended_by_flush = true;
	}
	if (!LIST_IS_EMPTY(&ctx->active_timer_queries))
		r600_suspend_timer_queries(ctx);

	ctx->streamout.suspended = false;
	if (ctx->streamout.begin_emitted) {
		r600_emit_streamout_end(ctx);
		ctx->streamout.suspended = true;
	}
}
Example #22
0
void
listDestroy(LIST_T *list, void (*destroy)(LIST_ENTRY_T *))
{
    LIST_ENTRY_T *entry;

    while (! LIST_IS_EMPTY(list)) {
        entry = list->forw;

        listRemoveEntry(list, entry);
        if (destroy)
            (*destroy)(entry);
        else
            free(entry);
    }

    free(list->name);
    free(list);
}
Example #23
0
DWORD NINE_WINAPI
NineBaseTexture9_SetLOD( struct NineBaseTexture9 *This,
                         DWORD LODNew )
{
    DWORD old = This->managed.lod;
    DWORD max_level;

    DBG("This=%p LODNew=%d\n", This, LODNew);

    user_assert(This->base.pool == D3DPOOL_MANAGED, 0);

    max_level = (This->base.usage & D3DUSAGE_AUTOGENMIPMAP) ?
                0 : This->base.info.last_level;
    This->managed.lod = MIN2(LODNew, max_level);

    if (This->managed.lod != old && This->bind_count && LIST_IS_EMPTY(&This->list))
       list_add(&This->list, &This->base.base.device->update_textures);

    return old;
}
Example #24
0
void
listRemoveEntry(LIST_T *list, LIST_ENTRY_T *entry)
{
    if (entry->back == NULL || entry->forw == NULL)
        return;

    entry->back->forw = entry->forw;
    entry->forw->back = entry->back;

    if (list->allowObservers && ! LIST_IS_EMPTY(list->observers)) {
        LIST_EVENT_T event;

        event.type = LIST_EVENT_LEAVE;
        event.entry = entry;

        (void) listNotifyObservers(list, &event);
    }

    list->numEnts--;
}
Example #25
0
int search_full_root(list_t * list, board_t * board, int a, int b, int depth, int search_type, int ThreadId) {

   int value;

   ASSERT(list_is_ok(list));
   ASSERT(board_is_ok(board));
   ASSERT(depth_is_ok(depth));
   ASSERT(search_type==SearchNormal||search_type==SearchShort);

   ASSERT(list==SearchRoot[ThreadId]->list);
   ASSERT(!LIST_IS_EMPTY(list));
   ASSERT(board==SearchCurrent[ThreadId]->board);
   ASSERT(board_is_legal(board));
   ASSERT(depth>=1);

   value = full_root(list,board,a,b,depth,0,search_type, ThreadId);

   ASSERT(value_is_ok(value));
   ASSERT(LIST_VALUE(list,0)==value);

   return value;
}
Example #26
0
void CM_Frame_Table::Inc_Replaceable_Pages(LIST *p_list_waiting_contexts)
{
 	TRACE_ENTRY(CM_Frame_Table::Inc_Replaceable_Pages);

	// Increment number of replaceable pages.
	m_num_pages_replaceable++;
	CT_ASSERT((m_num_pages_replaceable <= m_num_page_frames), CM_Frame_Table::Inc_Replaceable_Pages);
	m_p_stats->Set_Num_Pages_Replaceable(m_num_pages_replaceable);

	// See if any context is waiting for a frame.
	if (LIST_IS_EMPTY(&m_list_wait_frame))
		return;

	// There is a context waiting for a page frame.
	// Remove it from the list and put it on the ready list.
	Callback_Context *p_callback_context = 
		(Callback_Context *)LIST_REMOVE_TAIL(&m_list_wait_frame);
	m_p_stats->Dec_Num_Waits_For_Page_Frame();

	LIST_INSERT_TAIL(p_list_waiting_contexts, &p_callback_context->m_list);

}  // CM_Frame_Table::Inc_Replaceable_Pages
Example #27
0
int
listInsertEntryBefore(LIST_T * list,
                      LIST_ENTRY_T *succ,
                      LIST_ENTRY_T *entry)
{
    entry->forw = succ;
    entry->back = succ->back;
    succ->back->forw = entry;
    succ->back = entry;

    if (list->allowObservers && ! LIST_IS_EMPTY(list->observers)) {
        LIST_EVENT_T event;

        event.type = LIST_EVENT_ENTER;
        event.entry = entry;

        listNotifyObservers(list, &event);
    }

    list->numEnts++;

    return (0);
}
Example #28
0
void FF_Controller::Mark_Buss_Not_Busy(Flash_Address flash_address)
{
	// Turn off the busy flag.
	CT_ASSERT((m_buss_context), FF_Controller::Mark_Buss_Not_Busy);
	m_buss_context = 0;

	// See if another context is waiting for the buss.
	if (!LIST_IS_EMPTY(&m_context_list_wait_buss))
	{
		m_p_flash->m_stats.Dec_Num_Waits_Buss();

		FF_Controller_Context *p_controller_context;
		p_controller_context = (FF_Controller_Context *)LIST_REMOVE_HEAD(
			&m_context_list_wait_buss);
		
 		TRACEF(TRACE_L5, 
			(EOL "Mark_Buss_Not_Busy Making waiting context ready for unit_index = %d", 
			p_controller_context->m_flash_address.Unit_Index()));
 	
		// Queue context back on ready list for execution..
		p_controller_context->Make_Ready();
	}
		
} // FF_Controller::Mark_Buss_Not_Busy
Example #29
0
void
listDestroy(LIST_T *list, void (*destroy)(LIST_ENTRY_T *))
{
    LIST_ENTRY_T *entry;

    while (! LIST_IS_EMPTY(list)) {
        entry = list->forw;

        listRemoveEntry(list, entry);
        if (destroy)
            (*destroy)(entry);
        else
            free(entry);
    }

    if (list->allowObservers) {

        listDestroy(list->observers,
                    (LIST_ENTRY_DESTROY_FUNC_T)&listObserverDestroy);
    }

    free(list->name);
    free(list);
}
Example #30
0
int search_full_root(list_t * list, board_t * board, int depth, int search_type) {

   int value, a, b;

   ASSERT(list_is_ok(list));
   ASSERT(board_is_ok(board));
   ASSERT(depth_is_ok(depth));
   ASSERT(search_type==SearchNormal||search_type==SearchShort);

   ASSERT(list==SearchRoot->list);
   ASSERT(!LIST_IS_EMPTY(list));
   ASSERT(board==SearchCurrent->board);
   ASSERT(board_is_legal(board));
   ASSERT(depth>=1);

   if (SearchBest[SearchCurrent->multipv].value == 0){
	   a = -ValueInf;
	   b = +ValueInf;
   }
   else{
	   a = SearchBest[SearchCurrent->multipv].value - 40;
	   b = SearchBest[SearchCurrent->multipv].value + 40;
   }

   if (SearchInput->multipv > 0){
	   a = -ValueInf;
       b = +ValueInf;
   }

   value = full_root(list,board,a,b,depth,0,search_type);

   ASSERT(value_is_ok(value));
   ASSERT(LIST_VALUE(list,0)==value);

   return value;
}