コード例 #1
0
void initialize_utilities(void)
{
	tagged_commbuff_release_task.released_tagged_commbuffs =
	    (void *) (&released_tagged_commbuffs);
	initialize_task(&tagged_commbuff_release_task.releasetask,
			&ProcessReleasedCommBuffs);
}
コード例 #2
0
int main( void )
{
	initialize_edf_scheduler( &edf_scheduler_data, SCHEDULER_PRIORITY );

	// Create 3 tasks.
	xTaskCreate( task, "task0", configMINIMAL_STACK_SIZE, NULL, TASK_PRIORITY, &tcbs[0].handle );
	xTaskCreate( task, "task1", configMINIMAL_STACK_SIZE, NULL, TASK_PRIORITY, &tcbs[1].handle );
	xTaskCreate( task, "task2", configMINIMAL_STACK_SIZE, NULL, TASK_PRIORITY, &tcbs[2].handle );

	// Initialize task info for each of the tasks.
	initialize_task( &edf_scheduler_data, &list_items[0], &tcbs[0], 0, TASK0_EXECUTION_TIME, TASK0_PERIOD );
	initialize_task( &edf_scheduler_data, &list_items[1], &tcbs[1], 1, TASK1_EXECUTION_TIME, TASK1_PERIOD );
	initialize_task( &edf_scheduler_data, &list_items[2], &tcbs[2], 2, TASK2_EXECUTION_TIME, TASK2_PERIOD );

	vTaskStartScheduler();

	/* If all is well we will never reach here as the scheduler will now be
	running.  If we do reach here then it is likely that there was insufficient
	heap available for the idle task to be created. */
	for( ;; );

	return 0;
}
コード例 #3
0
ファイル: runtime-state.c プロジェクト: spiralofhope/mythryl
static void   set_up_pthread_state   (Pthread* pthread)   {
    //        ====================
    //
    pthread->heap				= pthread->task->heap;
    pthread->task->pthread			= pthread;
    //
    pthread->executing_mythryl_code		= FALSE;
    pthread->posix_signal_pending		= FALSE;
    pthread->mythryl_handler_for_posix_signal_is_running		= FALSE;
    //
    pthread->all_posix_signals.seen_count	= 0;
    pthread->all_posix_signals.done_count	= 0;
    pthread->next_posix_signal_id		= 0;
    pthread->next_posix_signal_count			= 0;
    //
    pthread->posix_signal_rotor		= MIN_SYSTEM_SIG;
    pthread->cleaning_signal_handler_state			= LIB7_SIG_IGNORE;
    pthread->cpu_time_at_start_of_last_cleaning		= MALLOC_CHUNK(Time);
    pthread->cumulative_cleaning_cpu_time			= MALLOC_CHUNK(Time);

    for (int i = 0;  i < MAX_POSIX_SIGNALS;  i++) {
	//
	pthread->posix_signal_counts[i].seen_count = 0;
	pthread->posix_signal_counts[i].done_count = 0;
    }

    // Initialize the Mythryl state, including the roots:
    //
    initialize_task( pthread->task );
    //
    pthread->task->argument			= HEAP_VOID;
    pthread->task->fate				= HEAP_VOID;
    pthread->task->current_closure		= HEAP_VOID;
    pthread->task->link_register		= HEAP_VOID;
    pthread->task->program_counter		= HEAP_VOID;
    pthread->task->exception_fate		= HEAP_VOID;
    pthread->task->current_thread		= HEAP_VOID;
    pthread->task->callee_saved_registers[0]	= HEAP_VOID;
    pthread->task->callee_saved_registers[1]	= HEAP_VOID;
    pthread->task->callee_saved_registers[2]	= HEAP_VOID;

    #if NEED_PTHREAD_SUPPORT
	pthread->pid		= 0;
	pthread->status		= NO_PTHREAD_ALLOCATED;
    #endif
}									// fun set_up_pthread_state