LRESULT CSettingsHotkeysDlg::OnBnClickedButtonHotkeyAssign(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	TestAndSet();
	ClearAndSet();

	return 0;
}
Esempio n. 2
0
void aquire_lock(){
	int delay = 1;
	while(TestAndSet() == locked){
		pause(delay);
		if(delay*2 > delay) delay *= 2;
	}
}
Esempio n. 3
0
void eventmanager_pumpEvents(void)
{
	static int pumping = 0;

	// Don't start pumping if we are doing it yet
	if(TestAndSet(&pumping)) return;

	// Pump events until there's no more
	while(!fixedQueue_isEmpty(&eventmanager_queue))
	{
//		VGA_text_putchar('0'+eventmanager_queue.length);
		pairEventData* pair = fixedQueue_head(&eventmanager_queue);

		VGA_text_putchar(pair->event[0]);
		event_func func = fixedDict_get(&eventmanager_events, pair->event);
		if(func)
		{
//			VGA_text_putchar(pair->data);
			func(pair->data);
		}

		fixedQueue_pop(&eventmanager_queue);
	}

	// Say we finished to pump events
	pumping = 0;
}
Esempio n. 4
0
void Spinlock::Take(int *lck){

	for (int i=0;i<16;i++)
		if (i!=2)  i8259_disable_irq_line(i);

	//while((*lck)<1){};

	while ( (TestAndSet(lck) )!=0);

//	--(*lck);
}
Esempio n. 5
0
File: main.c Progetto: olivo/BP
void acquire_lock(){
	int delay;
	enum lock_t cond;

	delay = 1;
	cond = TestAndSet();
	while(cond == locked){
#ifdef USE_BRANCHING_ASSUMES
		__CPROVER_assume(cond == locked);
#endif
		pause(delay);
		if(delay*2 > delay) 
			delay *= 2;
		cond = TestAndSet();		
	}
#ifdef USE_BRANCHING_ASSUMES
	__CPROVER_assume(!(cond == locked));
#endif
	assert(cond != lock);
}
LRESULT CSettingsHotkeysDlg::OnBnClickedButtonDefault(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	hkIndex index = GetCollIndex(_Settings.m_hotkey_groups[m_selGr].m_hotkeys[m_selHk].m_def_accel);
	if(index.group != -1 && index.hotkey != -1)
	{
		wchar_t collDefMsg[MAX_LOAD_STRING + 1];
		::LoadString(_Module.GetResourceInstance(),
					IDS_HOTKEY_DEFAULT_COLLISION,
					collDefMsg,
					MAX_LOAD_STRING + 1);

		CString collCmdName;
		collCmdName += _Settings.m_hotkey_groups[index.group].m_name;
		collCmdName += L'\\';
		collCmdName += _Settings.m_hotkey_groups[index.group].m_hotkeys[index.hotkey].m_name;

		CString collDefCmdMsg;
		collDefCmdMsg.Format(collDefMsg, collCmdName);

		wchar_t errCaption[MAX_LOAD_STRING + 1];
		::LoadString(_Module.GetResourceInstance(),
			IDS_ERRMSGBOX_CAPTION,
			errCaption,
			MAX_LOAD_STRING + 1);

		if(MessageBox(collDefCmdMsg, errCaption, MB_YESNO | MB_ICONEXCLAMATION) == IDYES)
		{
			m_accel = _Settings.m_hotkey_groups[m_selGr].m_hotkeys[m_selHk].m_def_accel;
			TestAndSet();
			ClearAndSet();
		}
	}
	else
	{
		m_accel = _Settings.m_hotkey_groups[m_selGr].m_hotkeys[m_selHk].m_def_accel;
		TestAndSet();
		ClearAndSet();
	}

	return 0;
}