Restore some unconditional locks from 0.2.19

This commit is contained in:
Martin Kroeker 2018-02-20 15:39:03 +01:00 committed by GitHub
parent 9e87e6f3d8
commit 6fb5b73320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 17 deletions

View File

@ -1016,9 +1016,7 @@ void *blas_memory_alloc(int procpos){
};
void *(**func)(void *address);
#if defined(SMP) && !defined(USE_OPENMP)
LOCK_COMMAND(&alloc_lock);
#endif
if (!memory_initialized) {
@ -1052,9 +1050,7 @@ void *blas_memory_alloc(int procpos){
memory_initialized = 1;
}
#if defined(SMP) && !defined(USE_OPENMP)
UNLOCK_COMMAND(&alloc_lock);
#endif
#ifdef DEBUG
printf("Alloc Start ...\n");
@ -1071,14 +1067,15 @@ void *blas_memory_alloc(int procpos){
if (!memory[position].used && (memory[position].pos == mypos)) {
#if defined(SMP) && !defined(USE_OPENMP)
LOCK_COMMAND(&alloc_lock);
#else
blas_lock(&memory[position].lock);
#endif
/* blas_lock(&memory[position].lock);*/
if (!memory[position].used) goto allocation;
#if defined(SMP) && !defined(USE_OPENMP)
UNLOCK_COMMAND(&alloc_lock);
#else
blas_unlock(&memory[position].lock);
#endif
/* blas_unlock(&memory[position].lock);*/
}
position ++;
@ -1094,14 +1091,15 @@ void *blas_memory_alloc(int procpos){
/* if (!memory[position].used) { */
#if defined(SMP) && !defined(USE_OPENMP)
LOCK_COMMAND(&alloc_lock);
#else
blas_lock(&memory[position].lock);
#endif
/* blas_lock(&memory[position].lock);*/
if (!memory[position].used) goto allocation;
#if defined(SMP) && !defined(USE_OPENMP)
UNLOCK_COMMAND(&alloc_lock);
#else
blas_unlock(&memory[position].lock);
#endif
/* blas_unlock(&memory[position].lock);*/
/* } */
position ++;
@ -1190,9 +1188,7 @@ void *blas_memory_alloc(int procpos){
if (memory_initialized == 1) {
#if defined(SMP) && !defined(USE_OPENMP)
LOCK_COMMAND(&alloc_lock);
#endif
if (memory_initialized == 1) {
@ -1201,9 +1197,8 @@ void *blas_memory_alloc(int procpos){
memory_initialized = 2;
}
#if defined(SMP) && !defined(USE_OPENMP)
UNLOCK_COMMAND(&alloc_lock);
#endif
}
#endif