小编use*_*709的帖子

Sed命令:如果存在,如何替换只是插入?

我需要在文件中编辑几行,这样如果一行以(av或avpgw)开头,则用新文本替换它们,否则只需在开头插入新文本.

我怎么能用sed做到这一点?

linux sed

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

Valgrind 错误:条件等待中 pthread_cancel 中的读/写无效

如果线程在等待条件下被取消,Valgrind 会报告 pthread_cond_wait() 中的读/写无效。不确定为什么会发生这种情况或者这是否是一个已知问题:

==321== Invalid write of size 4
==321==    at 0x4DF5785: _Unwind_ForcedUnwind (in /lib/i386-linux-
gnu/libgcc_s.so.1)
==321==    by 0x4059E1A: pthread_cond_timedwait@@GLIBC_2.3.2 
(pthread_cond_timedwait.S:245)
==321==    by 0x49DE28F: ???
==321==  Address 0x49de210 is on thread 2's stack
==321== 
==321== Invalid read of size 4
==321==    at 0x4DF579D: _Unwind_ForcedUnwind (in /lib/i386-linux-
gnu/libgcc_s.so.1)
==321==  Address 0x49de210 is on thread 2's stack
Run Code Online (Sandbox Code Playgroud)

最小的可运行代码如下:

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

static pthread_cond_t notification_cond = PTHREAD_COND_INITIALIZER;
static pthread_mutex_t notification_mutex = PTHREAD_MUTEX_INITIALIZER;
time_t interval = 0;
pthread_t …
Run Code Online (Sandbox Code Playgroud)

c valgrind pthreads

5
推荐指数
0
解决办法
650
查看次数

标签 统计

c ×1

linux ×1

pthreads ×1

sed ×1

valgrind ×1