Fix race condition in OnDiskInvertedlists. (#464)

pull/450/merge
Lucas Hosseini 2018-05-30 16:25:24 +02:00 committed by Matthijs Douze
parent 28e9f74511
commit dcd83f95b9
1 changed files with 5 additions and 3 deletions

View File

@ -164,6 +164,7 @@ struct OnDiskInvertedLists::OngoingPrefetch {
static void* prefetch_list (void * arg) {
Thread *th = static_cast<Thread*>(arg);
th->od->locks->lock_1(th->list_no);
size_t n = th->od->list_size(th->list_no);
const Index::idx_t *idx = th->od->get_ids(th->list_no);
const uint8_t *codes = th->od->get_codes(th->list_no);
@ -177,6 +178,7 @@ struct OnDiskInvertedLists::OngoingPrefetch {
for (size_t i = 0; i < n8;i++) {
cs += codes8[i];
}
th->od->locks->unlock_1(th->list_no);
global_cs += cs & 1;
return nullptr;
}