signal

signal & slot

别来无恙 提交于 2020-03-07 06:06:23
The Qt signals/slots and property system are based on the ability to introspect the objects at runtime. C++ does not offer introspection support natively, so Qt comes with a tool to provide it. That tool is MOC. It parses the header files and generates an additional C++ file that is compiled with the rest of the program   (1) signals, slots fucntion are simple functions, but MOC will see them   (2) Q_OBJECT defines a bunch of functions and a static QMetaObject , all signals/connections are stored here we can get the deatails about it from https://woboq.com/blog/how-qt-signals-slots-work.html

Linux Signal

*爱你&永不变心* 提交于 2020-03-04 08:07:07
哪些情况会引发信号 1.键盘事件 ctrl +c ctrl +\ 2.非法内存 如果内存管理出错,系统就会发送一个信号进行处理 3.硬件故障 同样的,硬件出现故障系统也会产生一个信号 4.环境切换 比如说从用户态切换到其他态,状态的改变也会发送一个信号,这个信号会告知给系统 进程表的表项中有一个软中断信号域,进程对不同的信号可以同时保留,但对于同一个信号,进程并不知道在处理之前来过多少个。 内核给一个进程发送软中断信号的方法,是在进程所在的进程表项的信号域设置对应于该信号的位。这里要补充的是,如果信号发送给一个正在睡眠的进程,那么要看 该进程进入睡眠的优先级,如果进程睡眠在可被中断的优先级上,则唤醒进程;否则仅设置进程表中信号域相应的位,而不唤醒进程。这一点比较重要,因为进程检 查是否收到信号的时机是:一个进程在即将从内核态返回到用户态时;或者,在一个进程要进入或离开一个适当的低调度优先级睡眠状态时。 运行如下命令,可看到Linux支持的信号列表: $ kill -l 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15)

Notes of \"Pentium Processor System Architecture\" - Pentium Signal Interface (part)

吃可爱长大的小学妹 提交于 2020-03-01 08:49:21
1. The Pentium processor address bus consits of two sets of signal lines: the address bus proper, consisting of 29 signal lines designated A31:A3 . the Byte Enable bus, consisting of the 8 signal lines designated BE#7:BE#0 . 2. A20 Mask( A20M# ) allows the processor to emulate the address wrap-around at the 1MB boundary that occurs on the 8086/8088. 3. Address Translation: 32-bit devices A31:A2 adn BE3#:BE0# 16-bit deviecs A23:A1 and BHE#,BLE# 8-bit devices A19:A0 4. A series of transceivers can do steering to pass data from one path to another when the device is smaller than 64-bits. ( BRDY#

DBus API的使用(讲的很清晰)

我是研究僧i 提交于 2020-02-29 11:21:36
转自 DBus 入门与应用--基本概念 上(C API 级别的使用观点) 、 DBus 入门与应用--基本概念 下(C API 级别的使用观点) 转载请注明出处 作者: 唐风 DBus是用来进行进程间通信的。下面这张图展示了一些DBus的大部分东西,但是它太复杂了: DBus 本身是构建在 Socket 机制之上。真正的通信还是由 Socket 来完成的。DBus 则是在这之上,制定了一些通信的协议,并提供了更高一层的接口,以更方便应用程序之间进行数据的交互。 在DBus的体系中,有一个常驻的进程 Daemon,所有进程间的交互都通过它来进行分发和管理。所有希望使用 DBus 进行通信的进程,都必须事先连上 Daemon,并将自己的名字注册到 Daemon 上,之后,Daemon会根据需要把消息以及数据发到相应的进程中。 首先使用 1 conn = dbus_bus_get(DBUS_BUS_SESSION, &err); 让应用程序和 DBus 之间取得连接。之后,使用函数 1 ret = dbus_bus_request_name(conn, " test.method.server " , 2 DBUS_NAME_FLAG_REPLACE_EXISTING 3 , &err); 将自己的进程名字注册到 Daemon 上。(参考前篇的[共通用代码])。这样通信就有了基础了。

进程间通信---信号

僤鯓⒐⒋嵵緔 提交于 2020-02-28 18:18:11
信号的概念 信号在我们的 生活中随处可见, 如:古代战争中摔杯为号;现代战争中的信号弹;体育比赛中使用的信号枪 ...... 他们都有共性: 1. 简单 2. 不能携带大量信息 3. 满足某个特设条件才发送。 信号是信息的载体, Linux/UNIX 环境下,古老、经典的通信方式, 现下依然是主要的通信手段。 Unix 早期版本就提供了信号机制,但不可靠,信号可能丢失。 Berkeley 和 AT&T 都对信号模型做了更改,增加了可靠信号机制。但彼此不兼容。 POSIX.1 对可靠信号例程进行了标准化。 信号的机制 A 给 B 发送信号, B 收到信号之前执行自己的代码,收到信号后,不管执行到程序的什么位置,都要暂停运行,去处理信号,处理完毕再继续执行。与硬件中断类似——异步模式。但信号是软件层面上实现的中断,早期常被称为“软中断”。 每个进程收到的所有信号,都是由内核负责发送的。 与信号相关的事件和状态 产生信号 : 1. 按键产生,如: Ctrl+c 、 Ctrl+z 、 Ctrl+\ 2. 系统调用产生,如: kill 、 raise 、 abort 3. 软件条件产生,如:定时器 alarm 4. 硬件异常产生,如:非法访问内存 ( 段错误 ) 、除 0( 浮点数例外 ) 、内存对齐出错 ( 总线错误 ) 5. 命令产生,如: kill 命令 递达 :递送并且到达进程。

聊聊artemis的SharedNothingBackupQuorum

╄→гoц情女王★ 提交于 2020-02-27 23:06:48
序 本文主要研究一下artemis的SharedNothingBackupQuorum SharedNothingBackupQuorum activemq-artemis-2.11.0/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/SharedNothingBackupQuorum.java public class SharedNothingBackupQuorum implements Quorum, SessionFailureListener { private TransportConfiguration liveTransportConfiguration; public enum BACKUP_ACTIVATION { FAIL_OVER, FAILURE_REPLICATING, ALREADY_REPLICATING, STOP; } private QuorumManager quorumManager; private String targetServerID = ""; private final NodeManager nodeManager; private final StorageManager storageManager;

Pattern Recognition Books

折月煮酒 提交于 2020-02-27 02:08:24
From: http://www.ph.tn.tudelft.nl/PRInfo/books.html 原来网站声明: Due to a reorganisation we are not able anymore to maintain these files. They will be removed in the near future. 所以保留一份备用(自己有的或者看的用了红色标注)。 Pattern Recognition Books Below a number of monographs is listed that can be useful for students and researchers in the field of pattern recognition. A list of book announcements received by email can be found here . There is also a general entry on Scientific Publishing Companies . Pattern Recognition and Statistical Learning Neural Networks Machine Learning and Information Theory Image

第十章:信号

[亡魂溺海] 提交于 2020-02-18 07:13:54
一、信号的概念 使用信号进行进程间通信(IPC)是UNIX的一种传统机制,Linux也支持这种机制。 每一个信号都有一个名字,这些名字都以SIG开头。如SIGINT表示终端中断(Ctrl + C产生),SIGQUIT表示终端退出,SIGIO表示异步I/O。 我们可以使用kill -l命令查看所有信号 信号属于异步事件,它的发生对于进程是随机的。进行必须要告诉内核当信号发生时怎么处理。 对于信号的处理,我们可以有以下几种方式: 1. 忽略此信号,但是SIGKILL和SIGSTOP不能忽略,因为这两个信号向内核提供使进程终止的方法。 2. 捕捉并处理信号。 3. 执行系统默认动作,如Ctrl + C就是终端中断,程序中不做任何信号处理。 二、signal()函数 signal()函数的使用方法: 1. 包含头文件:#include <signal.h>。 2. 定义信号处理函数:typedef void (*sighandler_t)(int signum),其中的signum是信号名。 3. 注册信号:signal(int signum, sighandler_t handler);。 示例如下: 1 #include <stdio.h> 2 #include <unistd.h> 3 #include <signal.h> 4 5 static void sig_handler

c 信号处理

本小妞迷上赌 提交于 2020-02-13 12:55:13
1. 使用signal(int signal, function)向内核注册信号处理函数 2. 使用raise()向本进程发送信号,通过kill()向其他进程发送信号 #include <stdio.h> #include <signal.h> #include <unistd.h> #include <stdlib.h> void signal_handle(int signal); int main(int argc, char **argv) { signal(SIGUSR1, signal_handle); int cpid, ppid; if ((cpid = fork()) == 0) { ppid = getppid(); cpid = getpid(); printf("cid:%d, ppid:%d\n", cpid, ppid); kill(ppid, SIGUSR1); printf("send signal to parent\n"); } else { int pid = wait(NULL); printf("pid after wait:%d\n", pid); } } void signal_handle(int signal) { printf("receive signal:%d\n", signal); }    来源: https://www

quartus II 自动生成testbench

守給你的承諾、 提交于 2020-02-12 00:24:57
如果自己不想写这些 testbench 的这些固定格式,可以在 quartus 里自动生成 testbench 文件的模板,然后往里面写信号就行了 步骤: processing->start->starttest bench template write 这里需要注意的是要在 仿真 选项里选择一个仿真工具,然后才会生成 testbench 自动生成的 testbench 模板格式如下: 以一位全加器f_adder的testbench为例 -- Copyright (C) 1991-2013 Altera Corporation -- Your use of Altera Corporation's design tools, logic functions -- and other software and tools, and its AMPP partner logic -- functions, and any output files from any of the foregoing -- (including device programming or simulation files), and any -- associated documentation or information are expressly subject -- to the terms