小编hor*_*str的帖子

在没有核心文件的情况下分析分段错误

假设我的二进制文件在我无法core dump使用ulimit -c. 工程师如何segmentation faults在如此真实的场景中调试?是否有任何其他方法可以在不core dumps生成的情况下调试或识别崩溃。

linux crash debugging crash-dumps linux-kernel

10
推荐指数
1
解决办法
1068
查看次数

T、volatile T 和 std::atomic<T> 之间有什么区别?

考虑下面的示例是打算等到另一个线程存储42在一个共享变量shared没有锁,无需等待线程终止,为什么会volatile Tstd::atomic<T>会要求或建议,以保证并发正确性?

#include <atomic>
#include <cassert>
#include <cstdint>
#include <thread>

int main()
{
  int64_t shared = 0;
  std::thread thread([&shared]() {
    shared = 42;
  });
  while (shared != 42) {
  }
  assert(shared == 42);
  thread.join();
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

使用 GCC 4.8.5 和默认选项,示例按预期工作。

c++ concurrency multithreading c++11 stdatomic

6
推荐指数
1
解决办法
126
查看次数

java.io.FileDescriptor.sync() 是否在 Linux 上同步目录?

fsync(2) 联机帮助页告诉如果同步文件,则明确需要同步目录。

io包中Java的sync方法怎么样?是在意那个吗?它是否取决于操作系统和/或文件系统?

我在http://docs.oracle.com/javase/7/docs/api/java/io/FileDescriptor.html#sync 中发现没有任何帮助...

java linux synchronization fsync

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