MDB_env *env = txn->mt_env;
unsigned int i;
uint16_t x;
- int rc;
+ int rc, new_notls = 0;
/* Setup db info */
txn->mt_numdbs = env->me_numdbs;
env->me_numreaders = env->me_txns->mti_numreaders;
UNLOCK_MUTEX_R(env);
r = &env->me_txns->mti_readers[i];
- if (!(env->me_flags & MDB_NOTLS) &&
- (rc = pthread_setspecific(env->me_txkey, r)) != 0) {
- env->me_txns->mti_readers[i].mr_pid = 0;
+ new_notls = (env->me_flags & MDB_NOTLS);
+ if (!new_notls && (rc=pthread_setspecific(env->me_txkey, r))) {
+ r->mr_pid = 0;
return rc;
}
}
if (env->me_maxpg < txn->mt_next_pgno) {
mdb_txn_reset0(txn);
+ if (new_notls) {
+ txn->mt_u.reader->mr_pid = 0;
+ txn->mt_u.reader = NULL;
+ }
return MDB_MAP_RESIZED;
}
ptr += wres;
}
#endif
- mdb_txn_abort(txn);
leave:
+ mdb_txn_abort(txn);
if (newfd != INVALID_HANDLE_VALUE)
close(newfd);