• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 檢查 Linux 下線程庫的類型

    發表于:2014-01-16來源:IT博客大學習作者:陳峰點擊數: 標簽:linux
    linux 下有 linuxthreads 和 NPTL,nptl 比 linuxthreads 先進,目前新內核都支持 ntpl,相應的 glibc 也支持,遇到老的機器,用的還是 linuxthreads,雖然二者二進制兼容,但是某些細節上還是不同,問題現實存在,無奈也得解決。

      linux 下有 linuxthreads 和 NPTL,nptl 比 linuxthreads 先進,目前新內核都支持 ntpl,相應的 glibc 也支持,遇到老的機器,用的還是 linuxthreads,雖然二者二進制兼容,但是某些細節上還是不同,問題現實存在,無奈也得解決。

      方法是用 confstr 來讀取系統的配置信息:

      #include

      static bool CheckNptl()

      {

      char buf[32];

      confstr(_CS_GNU_LIBPTHREAD_VERSION, buf, sizeof(buf));

      return strstr(buf, "NPTL") != NULL;

      }

      bool IsThreadLibNptl()

      {

      static bool is_nptl = CheckNptl(); // 緩存在靜態局部變量中,gcc 下靜態局部變量的初始化默認情況下是線程安全的。

      return is_nptl;

      }

      然后在代碼中就能方便使用了。

    原文轉自:http://blogread.cn/it/article/2054

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>