Pārlūkot izejas kodu

tm: callback param free functions can use shm_free()

The release function of the callback parameters is
called outside of the shared memory lock to make the
implementation of such functions easier.
Miklos Tirpak 16 gadi atpakaļ
vecāks
revīzija
54ec52858d
1 mainītis faili ar 6 papildinājumiem un 0 dzēšanām
  1. 6 0
      modules/tm/h_table.c

+ 6 - 0
modules/tm/h_table.c

@@ -142,7 +142,13 @@ void free_cell( struct cell* dead_cell )
 		cbs_tmp = cbs;
 		cbs = cbs->next;
 		if (cbs_tmp->release) {
+			/* It is safer to release the shm memory lock
+			 * otherwise the release function must to be aware of
+			 * the lock state (Miklos)
+			 */
+			shm_unlock();
 			cbs_tmp->release(cbs_tmp->param);
+			shm_lock();
 		}
 		shm_free_unsafe( cbs_tmp );
 	}