Skip to content

Commit e882f3d

Browse files
authored
Fix thread data race in memory.c
1 parent 00740c0 commit e882f3d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

driver/others/memory.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,12 +1075,13 @@ void *blas_memory_alloc(int procpos){
10751075

10761076
do {
10771077
/* if (!memory[position].used) { */
1078-
1079-
blas_lock(&memory[position].lock);
1078+
LOCK_COMMAND(&alloc_lock);
1079+
/* blas_lock(&memory[position].lock);*/
10801080

10811081
if (!memory[position].used) goto allocation;
1082-
1083-
blas_unlock(&memory[position].lock);
1082+
1083+
UNLOCK_COMMAND(&alloc_lock);
1084+
/* blas_unlock(&memory[position].lock);*/
10841085
/* } */
10851086

10861087
position ++;
@@ -1097,7 +1098,8 @@ void *blas_memory_alloc(int procpos){
10971098

10981099
memory[position].used = 1;
10991100

1100-
blas_unlock(&memory[position].lock);
1101+
UNLOCK_COMMAND(&alloc_lock);
1102+
/* blas_unlock(&memory[position].lock);*/
11011103

11021104
if (!memory[position].addr) {
11031105
do {

0 commit comments

Comments
 (0)