예제 #1
0
static uint8_t GBSIOLockstepNodeWriteSC(struct GBSIODriver* driver, uint8_t value) {
	struct GBSIOLockstepNode* node = (struct GBSIOLockstepNode*) driver;
	if ((value & 0x81) == 0x81 && node->p->d.attached > 1) {
		bool claimed = false;
		if (ATOMIC_CMPXCHG(node->p->masterClaimed, claimed, true)) {
			node->p->d.transferActive = TRANSFER_STARTING;
			node->p->d.transferCycles = GBSIOCyclesPerTransfer[(value >> 1) & 1];
			mTimingDeschedule(&driver->p->p->timing, &driver->p->event);
			mTimingDeschedule(&driver->p->p->timing, &node->event);
			mTimingSchedule(&driver->p->p->timing, &node->event, 0);
		}
예제 #2
0
파일: wurfld.c 프로젝트: passani/wurfld
static void wurfl_init() {
    NOTICE("Initializing WURFL");
    wurfl_handle new_wurfl = wurfl_create(); 
    wurfl_set_engine_target(new_wurfl, WURFL_ENGINE_TARGET_HIGH_PERFORMANCE);
    wurfl_set_cache_provider(new_wurfl, WURFL_CACHE_PROVIDER_DOUBLE_LRU, "10000,3000");
    wurfl_set_root(new_wurfl, wurfl_file);
    wurfl_error err = wurfl_load(new_wurfl);
    if (err != WURFL_OK) {
        WARN("Can't initialize wurfl %s", wurfl_get_error_message(new_wurfl));
        exit(-1);
    }
    wurfl_handle old_wurfl;
    do {
        old_wurfl = ATOMIC_READ(wurfl);
    } while (!ATOMIC_CMPXCHG(wurfl, old_wurfl, new_wurfl));
    if (old_wurfl)
        wurfl_destroy(old_wurfl);
    NOTICE("DONE");
}