小编Rib*_*ibo的帖子

所有Android Init Language'触发器'的列表是什么?

在/init.rc和其他Android Init Language'.rc'文件中,可以有'actions'部分开始:'on'在init进程中发生事件时执行一系列命令.所有"触发器"的列表是什么?似乎看到了一些特定的关键字触发器,如'boot','init','fs','early-init'和'post-fs-data'.这是完整的清单吗?在代码的某个地方?(除了关键字触发器之外,还有一些表达式触发器,请参见下文.)

我见过一些关键字触发器,知道调用它们的时间和原因会很好:

boot
early-init
init
fs
post-fs-data
charger
nonencrypted  
Run Code Online (Sandbox Code Playgroud)

除关键字外,表达式的exmaples还包括:

property:ro.factory.tool=1     -- when a property is set to a value
device-added-<path>  -- Triggered when a node is added when the equipment
device-removed-<path>  -- When the device is removed to add nodes
service-exited-<name>
Run Code Online (Sandbox Code Playgroud)

android triggers init

12
推荐指数
3
解决办法
1万
查看次数

如何终止/中断/中止Python控制台/sys.stdin readline()?

在线程中,我有一个循环从用户控制台读取输入。主线程忙于Tkinter mainloop()。如何终止该程序?

while True:
    ln = sys.stdin.readline()
    try:
        ln = ln[:-1]  # Remove LF from line
        if len(ln)==0: continue  # Ignore blank lines
        ...and so on
Run Code Online (Sandbox Code Playgroud)

主主题调用包含tk.mainloop()调用的startGUI()。当我按下窗口(这是Linux)上的X关闭按钮时,Tkinter关闭窗口,并且mainloop()返回。然后,我尝试关闭stdin,希望sys.stdin将关闭并导致sys.stdin.readline()将以一个不错的EOF终止,从而允许我的stdinLoop线程终止。

# Start up the GUI window
startGUI()  # Doesn't return until GUI window is closed, tk.mainloop is called here
#
# Wait for stdinLoop thread to finish
sys.stdin.close()  # Hopefully cause stdinTh to close
print("waiting for stdinTh to join")
stdinTh.join()
print("joined stdinTh")
Run Code Online (Sandbox Code Playgroud)

sys.stdin.realine()永远不会在sys.stdin.close()之后返回。(stdinTh.join()用于同步关闭。)

我认为Python readline()做的聪明的事情(在NetCommand中)在关闭stdin时不会干净地返回。

Python认为同时拥有Tkinter GUI和交互使用stdin 是否有害

我尝试使用sys.stdin.read(1),但是似乎缓冲了一行并返回了整行-而不是像我认为的read(1)那样读取一个字节/字符。

python multithreading tkinter python-2.7

3
推荐指数
1
解决办法
755
查看次数

标签 统计

android ×1

init ×1

multithreading ×1

python ×1

python-2.7 ×1

tkinter ×1

triggers ×1