小编bav*_*bav的帖子

GNU Make:警告:忽略目标`xxx'的旧命令

你能帮我理解GNU Make(版本3.81)如何处理简单的Makefile吗?这是文件:

.PHONY: a b c e f
a : b c
    @echo "> a(b,c)"
e : a
    @echo "> e(a)"
e : f
    @echo "> e(f)"
f :
    @echo "> f()"
b :
    @echo "> b()"
c :
    @echo "> c()"
Run Code Online (Sandbox Code Playgroud)

现在我运行命令

make e
Run Code Online (Sandbox Code Playgroud)

建立'e'目标.Make的输出如下:

Makefile:7: warning: overriding commands for target `e'
Makefile:5: warning: ignoring old commands for target `e'
> f()
> b()
> c()
> a(b,c)
> e(f)
Run Code Online (Sandbox Code Playgroud)

http://www.gnu.org/software/make/manual/html_node/Error-Messages.html给出了下一个解释:

'警告:覆盖目标`xxx'的配方

'警告:忽略目标`xxx'的旧配方

GNU make只允许为每个目标指定一个配方(双冒号规则除外).如果为已经定义为具有目标的目标提供配方,则会发出此警告,第二个配方将覆盖第一个配方.

但是从输出中我们可以看到构建'a'目标的命令也被执行.我认为根据'Error-Messages'页面中的描述make,在处理这个Makefile并尝试构建'e'目标(make …

makefile gnu-make

13
推荐指数
1
解决办法
2万
查看次数

Python pthread_detach 模拟

各位晚上好。我正在使用 Python 2.7 和线程模块编写多线程程序。这是一个代码示例:

# Importing myFunc function which will be run in the new thread
from src.functions import myFunc
# Importing a threading module
import threading
# Creating and running new thread initiated by our function
# and some parameters.
t = threading.Thread(target=myFunc, args=(1, 2, 3))
t.start()
Run Code Online (Sandbox Code Playgroud)

我知道在 C++(POSIX 线程库)中有一个pthread_detach()函数,它将正在运行的线程置于分离状态。它保证该线程在函数结束后将资源释放回系统。那么,Python 中有类似的函数吗?或者,也许,Python中根本不需要分离线程,线程占用的资源会在线程函数结束后自动释放?

我尝试在docs.python.org和 Google上搜索信息,但没有结果。

python pthreads detach

5
推荐指数
1
解决办法
3862
查看次数

标签 统计

detach ×1

gnu-make ×1

makefile ×1

pthreads ×1

python ×1