소스 검색

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

原因在于atomic.AddUint64作用的指针必须是8字节对齐的,将这些变量放置在结构体的头部解决了这个问题。
Hui Chen 12 년 전
부모
커밋
1de557be97
1개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  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) {