存档

文章标签 ‘线程’

CLucene源码剖析(三) 实现跨平台的线程安全

2009年5月29日 没有评论

在多线程编程中,程序的线程安全(thread-safe)是十分重要的,要做到这一点,一方面要在程序设计的过程中,尽可能设计多的单线程访问的数据结构,一方面就是合理的使用锁(Mutex)。在CLucene中,实现了如下跨平台的锁相关的宏:
(1) _LUCENE_SLEEP(x) 挂起当前线程 x微秒
(2) _LUCENE_THREADMUTEX 线程锁(mutex)
(3) _LUCENE_CURRTHREADID 获取当前线程的thread ID
(4) _LUCENE_THREADID_TYPE thread ID的类型定义 阅读全文…


Warning: mysql_query() [function.mysql-query]: Access denied for user 'root'@'localhost' (using password: NO) in /home/wuzeshengpwmuqzeeas7h4eknug/wwwroot/wp-content/plugins/quickstats/quickstats.php on line 345

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/wuzeshengpwmuqzeeas7h4eknug/wwwroot/wp-content/plugins/quickstats/quickstats.php on line 345

Warning: mysql_query() [function.mysql-query]: Access denied for user 'root'@'localhost' (using password: NO) in /home/wuzeshengpwmuqzeeas7h4eknug/wwwroot/wp-content/plugins/quickstats/quickstats.php on line 346

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/wuzeshengpwmuqzeeas7h4eknug/wwwroot/wp-content/plugins/quickstats/quickstats.php on line 346

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/wuzeshengpwmuqzeeas7h4eknug/wwwroot/wp-content/plugins/quickstats/quickstats.php on line 346