Browse code

cfg framework: timer must reset the handles more frequently

The timer processes must reset the cfg group handles after
each registered timer function is executed, otherwise cfg_select()
in one function may influence another function.

Miklos Tirpak authored on 04/10/2010 14:27:24
Showing 2 changed files
... ...
@@ -421,6 +421,16 @@ static inline void cfg_reset_handles(void)
421 421
 			cfg_update_local(1); \
422 422
 	} while(0)
423 423
 
424
+/* Reset all the group handles in the child process,
425
+ * i.e. move them back to the default local configuration.
426
+ */
427
+#define cfg_reset_all() \
428
+	do { \
429
+		if (unlikely(cfg_ginst_count)) \
430
+			cfg_reset_handles(); \
431
+	} while(0)
432
+
433
+
424 434
 /* searches a group by name */
425 435
 cfg_group_t *cfg_lookup_group(char *name, int len);
426 436
 	
... ...
@@ -892,6 +892,8 @@ inline static void timer_list_expire(ticks_t t, struct timer_head* h
892 892
 #endif
893 893
 			UNLOCK_TIMER_LIST(); /* acts also as write barrier */ 
894 894
 				ret=tl->f(t, tl, tl->data);
895
+				/* reset the configuration group handles */
896
+				cfg_reset_all();
895 897
 				if (ret==0){
896 898
 					UNSET_RUNNING();
897 899
 					LOCK_TIMER_LIST();
... ...
@@ -1147,6 +1149,8 @@ void slow_timer_main()
1147 1147
 				SET_RUNNING_SLOW(tl);
1148 1148
 				UNLOCK_SLOW_TIMER_LIST();
1149 1149
 					ret=tl->f(*ticks, tl, tl->data);
1150
+					/* reset the configuration group handles */
1151
+					cfg_reset_all();
1150 1152
 					if (ret==0){
1151 1153
 						/* one shot */
1152 1154
 						UNSET_RUNNING_SLOW();