我pthread.h在一个*.cc文件中使用.当我尝试使用pthread_exit(0);或pthread_join(mythrds[yy],NULL);它说:
.cc:(.text+0x3e): undefined reference to `pthread_exit'
Run Code Online (Sandbox Code Playgroud)
当*.c使用gcc 在文件中编译非常相似的代码时,它工作得很完美.我如何在c ++中使用pthread ..(我还添加了-lpthread)
..
void *myThreads ( void *ptr )
{
...
pthread_exit(0);
}
..
Run Code Online (Sandbox Code Playgroud)
标志:
g++ -lpthread -Wall -static -W -O9 -funroll-all-loops -finline -ffast-math
Run Code Online (Sandbox Code Playgroud) 例如我这样的代码
...获取一些内存并丢失所有指向该内存的指针,以便System.gc(); 可以收集它.
调用System.gc();
做一些其他的任务;
这里做"做其他一些任务;" 和"System.gc();" 在paralel工作或做"做其他一些任务;" 等待"System.gc();" 被执行
谢谢
java concurrency multithreading garbage-collection sequential
我有一个运行java二进制代码(xx.jar文件)的服务器程序.在它运行时我错误地删除了xx.jar文件.该计划继续运行.但我不确定结果是否正确,我不确定程序是否会失败.
当我删除xx.jar文件时,程序在一个方法中很长一段时间仍然在那个方法调用中.当它调用另一个方法调用时,我的程序会失败吗?
我问这个问题,因为如果删除文件没有任何损害,我将在服务器机器上获得大约3-4小时
c++ ×2
java ×2
compile-time ×1
concurrency ×1
jar ×1
linker ×1
pthreads ×1
runtime ×1
sequential ×1
sizeof ×1