Browse Source

修正32位操作系统下程序崩溃的问题。

原因在于atomic.AddUint64作用的指针必须是8字节对齐的,将这些变量放置在结构体的头部解决了这个问题。
Hui Chen 12 years ago
parent
commit
1de557be97
1 changed files with 5 additions and 5 deletions
  1. 5 5
      engine/engine.go

+ 5 - 5
engine/engine.go

@@ -19,6 +19,11 @@ const (
 )
 
 type Engine struct {
+	// 计数器,用来统计有多少文档被索引等信息
+	numDocumentsIndexed uint64
+	numIndexingRequests uint64
+	numTokenIndexAdded  uint64
+
 	// 记录初始化参数
 	initOptions types.EngineInitOptions
 	initialized bool
@@ -37,11 +42,6 @@ type Engine struct {
 	indexerLookupChannels             []chan indexerLookupRequest
 	rankerRankChannels                []chan rankerRankRequest
 	rankerRemoveScoringFieldsChannels []chan rankerRemoveScoringFieldsRequest
-
-	// 计数器,用来统计有多少文档被索引等信息
-	numDocumentsIndexed uint64
-	numIndexingRequests uint64
-	numTokenIndexAdded  uint64
 }
 
 func (engine *Engine) Init(options types.EngineInitOptions) {