File:  [Isaki's NoNo m68k/m88k emulator] / nono / vm / uimessage.cpp
Revision 1.1.1.3 (vendor branch): download - view: text, annotated - select for diffs
Wed Apr 29 17:05:50 2026 UTC (2 months, 3 weeks ago) by root
Branches: MAIN, Isaki
CVS tags: v027, v026, v025, HEAD
nono 1.5.0

//
// nono
// Copyright (C) 2021 nono project
// Licensed under nono-license.txt
//

//
// UI スレッドへのメッセージ機構
//

#include "uimessage.h"

// コンストラクタ
UIMessage::UIMessage()
{
}

// デストラクタ
UIMessage::~UIMessage()
{
}

// コールバック関数をセットして、サービスを開始。
void
UIMessage::StartUIMessage(const std::function<void(uint, int)>& func_)
{
	std::lock_guard<std::mutex> lock(mtx);
	func = func_;
}

// サービスを停止。
void
UIMessage::StopUIMessage()
{
	std::lock_guard<std::mutex> lock(mtx);
	func = std::function<void(uint, int)>();
}

// UIMessage をポスト(実行)する。
void
UIMessage::Post(uint id, int arg)
{
	std::lock_guard<std::mutex> lock(mtx);
	if ((bool)func) {
		func(id, arg);
	}
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.