use BGL lock for big operations.
This commit is contained in:
parent
c7d2973c1e
commit
a351e1f38f
10
C/grow.c
10
C/grow.c
@ -1428,12 +1428,12 @@ Yap_locked_growheap(bool fix_code, size_t in_size, void *cip)
|
|||||||
bool blob_overflow = (NOfBlobs > NOfBlobsMax);
|
bool blob_overflow = (NOfBlobs > NOfBlobsMax);
|
||||||
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
LOCK(GLOBAL_ThreadHandlesLock);
|
LOCK(GLOBAL_BGL);
|
||||||
#endif
|
#endif
|
||||||
// make sure that we cannot have more than a thread life
|
// make sure that we cannot have more than a thread life
|
||||||
if (Yap_NOfThreads() > 1) {
|
if (Yap_NOfThreads() > 1) {
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
UNLOCK(GLOBAL_ThreadHandlesLock);
|
UNLOCK(GLOBAL_BGL);
|
||||||
#endif
|
#endif
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
if (NOfAtoms > 2*AtomHashTableSize || blob_overflow) {
|
if (NOfAtoms > 2*AtomHashTableSize || blob_overflow) {
|
||||||
@ -1454,14 +1454,14 @@ Yap_locked_growheap(bool fix_code, size_t in_size, void *cip)
|
|||||||
res = growatomtable( PASS_REGS1 );
|
res = growatomtable( PASS_REGS1 );
|
||||||
} else {
|
} else {
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
UNLOCK(GLOBAL_ThreadHandlesLock);
|
UNLOCK(GLOBAL_BGL);
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
LeaveGrowMode(GrowHeapMode);
|
LeaveGrowMode(GrowHeapMode);
|
||||||
if (res) {
|
if (res) {
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
UNLOCK(GLOBAL_ThreadHandlesLock);
|
UNLOCK(GLOBAL_BGL);
|
||||||
#endif
|
#endif
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -1474,7 +1474,7 @@ Yap_locked_growheap(bool fix_code, size_t in_size, void *cip)
|
|||||||
#endif
|
#endif
|
||||||
LeaveGrowMode(GrowHeapMode);
|
LeaveGrowMode(GrowHeapMode);
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
UNLOCK(GLOBAL_ThreadHandlesLock);
|
UNLOCK(GLOBAL_BGL);
|
||||||
#endif
|
#endif
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user