Esempio n. 1
0
void SharedLibraryImpl::unloadImpl()
{
    FastMutex::ScopedLock lock(_mutex);

    if (_moduleId)
    {
        unldByModuleId(_moduleId, 0);
        _moduleId = 0;
    }
}
Esempio n. 2
0
/**
 * 
 * Start the robot code.
 * This function starts the robot code running by spawning a task. Currently tasks seemed to be
 * started by LVRT without setting the VX_FP_TASK flag so floating point context is not saved on
 * interrupts. Therefore the program experiences hard to debug and unpredictable results. So the
 * LVRT code starts this function, and it, in turn, starts the actual user program.
 */
void RobotBase::startRobotTask(FUNCPTR factory)
{
#ifdef SVN_REV
	if (strlen(SVN_REV))
	{
		printf("WPILib was compiled from SVN revision %s\n", SVN_REV);
	}
	else
	{
		printf("WPILib was compiled from a location that is not source controlled.\n");
	}
#else
	printf("WPILib was compiled without -D'SVN_REV=nnnn'\n");
#endif

	// Check for startup code already running
	int32_t oldId = taskNameToId(const_cast<char*>("FRC_RobotTask"));
	if (oldId != ERROR)
	{
		// Find the startup code module.
		char moduleName[256];
		moduleNameFindBySymbolName("FRC_UserProgram_StartupLibraryInit", moduleName);
		MODULE_ID startupModId = moduleFindByName(moduleName);
		if (startupModId != NULL)
		{
			// Remove the startup code.
			unldByModuleId(startupModId, 0);
			printf("!!!   Error: Default code was still running... It was unloaded for you... Please try again.\n");
			return;
		}
		// This case should no longer get hit.
		printf("!!!   Error: Other robot code is still running... Unload it and then try again.\n");
		return;
	}

	// Let the framework know that we are starting a new user program so the Driver Station can disable.
	FRC_NetworkCommunication_observeUserProgramStarting();

	// Let the Usage Reporting framework know that there is a C++ program running
	nUsageReporting::report(nUsageReporting::kResourceType_Language, nUsageReporting::kLanguage_CPlusPlus);
	
	RobotBase::WriteVersionString();

	// Start robot task
	// This is done to ensure that the C++ robot task is spawned with the floating point
	// context save parameter.
	Task *task = new Task("RobotTask", (FUNCPTR)RobotBase::robotTask, Task::kDefaultPriority, 64000);
	task->Start((int32_t)factory, (int32_t)task);
}
Esempio n. 3
0
static void unload_old_module(void)
{
	/* FIXME: This code currently does what WPILib does, but it isn't clear
	 *        why we should check that the task is running at all */
	int32_t old_task_id = taskNameToId((char *)TASK_NAME);
	if (old_task_id == ERROR)
		return;

	/* XXX: how do we avoid finding ourselves and ensure we find the old
	 * module?
	 *
	 * - Right now we just find the oldest (earliest in the system)
	 */
	MODULE_ID old_module_id = module_find_earliest_by_symbolname(STR(INIT_FUNC));
	if (!old_module_id)
		return;

	unldByModuleId(old_module_id, 0);
}
void dbgsysUnloadLibrary(void *handle)
{
    unldByModuleId(handle);
}
Esempio n. 5
0
int vxworks_dlclose(ACE_SHLIB_HANDLE lib)
{
    return unldByModuleId((MODULE_ID)lib, 0);
}