小编Joe*_*yle的帖子

当多个模式规则与目标匹配时

GNU使手动

有可能不止一个模式规则符合这些标准.在这种情况下,make将选择具有最短词干的规则(即,最具体匹配的模式).

所以它让我感到惊讶:

$ touch make_specific.cpp

$ cat Makefile.general_first
%.o: %.cpp
@echo using general rule
$(CXX) -c $< -o $@

%_specific.o: %_specific.cpp
@echo using specific rule
$(CXX) -c $< -o $@

$ make -B -f Makefile.general_first make_specific.o
using general rule
g++44 -c make_specific.cpp -o make_specific.o
Run Code Online (Sandbox Code Playgroud)

多模式规则匹配目标,并因为对干%_specific.o : %_specific.cpp规则(在这种情况下,"制作")比杆的短%.o : %.cpp规则,我预期的要选择的特定规则,但事实并非如此.

我错过了什么?

makefile gnu-make

16
推荐指数
1
解决办法
3730
查看次数

远程emacs客户端连接,但不在终端中创建新帧

我在TCP模式下配置并启动了emacs服务器:

  1. 新增(setq server-host "10.16.184.33")(setq server-use-tcp t)到的.emacs
  2. emacs --daemon

在同一台主机上,运行emacsclient -t会在当前终端中显示一个emacs emacsclient -c框架,并按预期运行会启动一个新的图形客户端框架.

在另一台主机上,运行emacsclient -t -f ~/.emacs.d/server/server似乎成功连接到远程emacs服务器,但终端中没有创建任何帧:

$ emacsclient -t -f ~/.emacs.d/server/server
emacsclient: connected to remote socket at 10.16.184.33
Run Code Online (Sandbox Code Playgroud)

此时,emacsclient正在前台运行,而Ctrl-c则使用SIGTERM将其停止.

server-client变量的值显示远程emacs客户端已连接:

server-clients's value is
(#<process server <10.16.184.33:52710>> #<process server <10.16.177.8:59460>>)
Run Code Online (Sandbox Code Playgroud)

我检查过的事情:

  • Emacs和emacsclient的版本:全部24.3
  • 当交换哪台机器是服务器和远程客户端时,会出现同样的问题,除了......
  • emacsclient打印一条额外的错误消息

    emacsclient: connected to remote socket at 10.16.177.8
    *ERROR*: Could not open file: /dev/pts/26
    
    Run Code Online (Sandbox Code Playgroud)

还有什么想检查或配置的想法?

emacs emacsclient

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

使用用于用户定义的哈希和比较的自由函数声明unordered_set

这段代码用g ++ 4.4和'-std = c ++ 0x'编译得很好.

#include <unordered_set>

namespace
{

size_t IntHash ( int i )
{
    return i;
}

bool IntComp ( int i, int j )
{
    return i == j;
}

}

int main ( int argc, char* argv[] )
{
    typedef std::pointer_to_unary_function<int, size_t> CustomHash;
    typedef std::pointer_to_binary_function<int, int, bool>
        CustomComp;

    typedef std::unordered_set<int, CustomHash, CustomComp> DeprecatedSet;

    DeprecatedSet deprecatedSet ( 10, std::ptr_fun ( IntHash ), std::ptr_fun ( IntComp ) );

    deprecatedSet.insert ( 5 );
    deprecatedSet.insert ( 10 ); …
Run Code Online (Sandbox Code Playgroud)

c++ c++11

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

pthread_cond_timedwait提前一秒返回

下面的程序产生这个输出:

$ ./test_condvar 9000
1343868189.623067126 1343868198.623067126 FIRST
1343868197.623132345 1343868206.623132345 TIMEOUT
1343868205.623190120 1343868214.623190120 TIMEOUT
1343868213.623248184 1343868222.623248184 TIMEOUT
1343868221.623311549 1343868230.623311549 TIMEOUT
1343868229.623369718 1343868238.623369718 TIMEOUT
1343868237.623428856 1343868246.623428856 TIMEOUT
Run Code Online (Sandbox Code Playgroud)

请注意,pthread_cond_timedwait跨行读取显示预期9秒的时间增量,但是向下读取列显示在8秒内返回ETIMEDOUT.

pthread lib是glibc 2.12.运行Red Hat EL6.uname -a节目2.6.32-131.12.1.el6.x86_64 #1 SMP Tue Aug 23 11:13:45 CDT 2011 x86_64 x86_64 x86_64 GNU/Linux

它看起来像pthread_cond_timedwait依赖于lll_futex_timed_wait超时行为.

关于在哪里搜索解释的任何想法?

#include <time.h>
#include <sys/time.h>
#include <pthread.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>

int main ( int argc, char *argv[] )
{
    pthread_mutexattr_t mtx_attr;
    pthread_mutex_t mtx; …
Run Code Online (Sandbox Code Playgroud)

linux glibc pthreads

0
推荐指数
1
解决办法
2117
查看次数

标签 统计

c++ ×1

c++11 ×1

emacs ×1

emacsclient ×1

glibc ×1

gnu-make ×1

linux ×1

makefile ×1

pthreads ×1