MITpthreads注重变乱

 作者:天极软件 源头:天极软件

这节描绘在运用 MIT-pthreads 所触及的一些标题。

注重:在Linux上,你应该不运用MIT-pthreads而是安设LinuxThreads!见4.11.5 Linux 注重变乱(统统的Linux 版本)。

假如你的琐细不提供原生的线程支持,你将需要运用MIT-pthreads包机关MySQL。这包孕年夜多半FreeBSD琐细、SunOS 4.x 、Solaris 2.4和更早版本及其他,见4.2 MySQL 支持的操作琐细。

  • 在年夜多半琐细上,你能经过运用configure,用--with-mit-threads选项来强迫运转MIT-pthreads:
    shell> ./configure -- with-mit-threads

    当运用MIT-pthreads时,不支持在一个非源代码目录机关,由于我们想要使我们对代码的改动减到最小。

  • MIT-pthreads不支持用于完成Unix套接字的AF_UNIX协议。这意味着假如你运用MIT-pthreads中断编译,统统的链接必需运用TCP/IP中断(它有点慢)。假如在机关MySQL后,你发现你不克不及与本地的效力器跟尾,很可所以客户措施正在试图用缺省的Unix套接字与localhost跟尾。运用主机选择(-h--host)分明地指定本地的主机名字,实行做一个TCP/IP跟尾到mysql
  • 决定能否运用MIT-pthreads的反省仅在处置责罚效力器代码的设置历程时期迸发。假如曾经用--without-server设置了分发并只机关客户代码,客户将不晓得MIT-pthreads能否正在被运用并且能否运用缺省的Unix套接字跟尾。由于Unix套接字不克不及在MIT-pthreads下面事情,这意味着当你运转客户措施时,你将需要运用-h--host
  • 当运用MIT-pthreads编译MySQL时,由于成效缘由,琐细锁定缺省为阻止运用。你可以用--use-locking选项告诉效力器运用琐细锁定。
  • 偶然pthreadbind()饬令不克不及绑定一个套接字但没有任何错误新闻(至少在Solaris上),后果是统统到效力器的跟尾均掉败。比喻:
    shell> mysqladmin version
    mysqladmin: connect to server at '' failed;
    error: 'Can't connect to mysql server on localhost (146)'
    

    打点它的办法是杀归天mysqld效力器并且重启它。这只需当我们强迫效力器阻止并即刻中断重启时在迸发。

  • 运用MIT-pthreads,sleep()琐细挪用不是可中断的SIGINT(break)。这只需在你运转mysqladmin --sleep时本领注重到。你在中断起感化并且历程阻止之前必需等待sleep()终了。
  • 当链接时,你可以会收到多么的警告新闻(至少在Solaris上);他们可以被轻忽:
    ld: warning: symbol `_iob' has differing sizes:
        (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
    file /usr/lib/libc.so value=0x140);
        /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
    ld: warning: symbol `__iob' has differing sizes:
        (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
    file /usr/lib/libc.so value=0x140);
        /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
    
  • 一些其他的警告也可被纰漏:
    implicit declaration of function `int strtoll(...)'
    implicit declaration of function `int strtoul(...)'
    
  • 我们还没有让readline可在MIT-pthreads上事情。(这不需要,但是可以某些人有兴味。)





版权声明: 原创作品,允许转载,转载时请务必以超链接体式格局标明文章 原始原由 、作者信息和本声明。否则将清查法律责任。

原文地址:https://www.cnblogs.com/zgqjymx/p/1975275.html