File:  [Isaki's NoNo m68k/m88k emulator] / nono / host / signalthread.h
Revision 1.1.1.4 (vendor branch): download - view: text, annotated - select for diffs
Wed Apr 29 17:06:02 2026 UTC (3 months ago) by root
Branches: MAIN, Isaki
CVS tags: v027, HEAD
nono 1.7.0

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

//
// シグナルスレッド
//

#pragma once

#include "thread.h"

class SignalThread : public ThreadDevice
{
	using inherited = ThreadDevice;

 public:
	SignalThread();
	~SignalThread() override;

	bool StartThread() override;
	void ThreadRun() override;
	void Terminate() override;

	// このスレッドにシグナルを投げる
	void Kill(int signo);

 private:
	// シグナルをブロック/アンブロックする
	void Mask(int how, int signo);

	// ブロックするシグナル集合
	sigset_t waitset {};

	// コマンド(フラグ)
	// 終了フラグは立てるだけ、読むだけなので atomic じゃなくてもいいはず。
	volatile bool request_terminate {};
};

inline SignalThread *GetSignalThread() {
	return Object::GetObject<SignalThread>(OBJ_SIGNAL_THREAD);
}

unix.superglobalmegacorp.com

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