[teklib-general] teklib: Interval test: Fixed race condition in time request usag...

Timm S. Mueller tmueller at neoscientists.org
Wed Jan 14 13:36:44 CET 2009


details:   http://hg.teklib.org/teklib/rev/ca74efba3806
changeset: 233:ca74efba3806
user:      Timm S. Mueller <tmueller at neoscientists.org>
date:      Wed Jan 14 00:43:53 2009 +0100
description:
Interval test: Fixed race condition in time request usage; more display
drivers adapted to new timing functions

diffs (truncated from 149 to 100 lines):

diff -r 952ac202cdb9 -r ca74efba3806 src/display_directfb/display_dfb_mod.c
--- a/src/display_directfb/display_dfb_mod.c	Tue Jan 13 23:29:57 2009 +0100
+++ b/src/display_directfb/display_dfb_mod.c	Wed Jan 14 00:43:53 2009 +0100
@@ -535,7 +535,7 @@
 	TTIME waitt, nowt;
 
 	TExecGetSystemTime(inst->dfb_ExecBase, inst->dfb_TimeReq, &nextt);
-	TExecAddTime(inst->dfb_ExecBase, &nextt, &intt);
+	TAddTime(&nextt, &intt);
 
 	TDBPRINTF(TDB_ERROR,("Device instance running\n"));
 
@@ -563,7 +563,7 @@
 		/* calculate new delta to wait: */
 		TExecGetSystemTime(inst->dfb_ExecBase, inst->dfb_TimeReq, &nowt);
 		waitt = nextt;
-		TExecSubTime(inst->dfb_ExecBase, &waitt, &nowt);
+		TSubTime(&waitt, &nowt);
 
 		tv.tv_sec = waitt.tdt_Int64 / 1000000;
 		tv.tv_usec = waitt.tdt_Int64 % 1000000;
@@ -587,16 +587,16 @@
 
 		/* check if time interval has expired: */
 		TExecGetSystemTime(inst->dfb_ExecBase, inst->dfb_TimeReq, &nowt);
-		if (TExecCmpTime(inst->dfb_ExecBase, &nowt, &nextt) > 0)
+		if (TCmpTime(&nowt, &nextt) > 0)
 		{
 			/* expired; send interval: */
 			do_interval = TTRUE;
-			TExecAddTime(inst->dfb_ExecBase, &nextt, &intt);
-			if (TExecCmpTime(inst->dfb_ExecBase, &nowt, &nextt) >= 0)
+			TAddTime(&nextt, &intt);
+			if (TCmpTime(&nowt, &nextt) >= 0)
 			{
 				/* nexttime expired already; create new time from now: */
 				nextt = nowt;
-				TExecAddTime(inst->dfb_ExecBase, &nextt, &intt);
+				TAddTime(&nextt, &intt);
 			}
 		}
 
diff -r 952ac202cdb9 -r ca74efba3806 src/display_rawfb/display_fb_mod.c
--- a/src/display_rawfb/display_fb_mod.c	Tue Jan 13 23:29:57 2009 +0100
+++ b/src/display_rawfb/display_fb_mod.c	Wed Jan 14 00:43:53 2009 +0100
@@ -445,7 +445,7 @@
 	TTIME waitt, nowt;
 
 	TExecGetSystemTime(inst->fbd_ExecBase, inst->fbd_TimeReq, &nextt);
-	TExecAddTime(inst->fbd_ExecBase, &nextt, &intt);
+	TAddTime(&nextt, &intt);
 
 	TDBPRINTF(TDB_INFO,("Device instance running\n"));
 
@@ -462,7 +462,7 @@
 		/* calculate new delta to wait: */
 		TExecGetSystemTime(inst->fbd_ExecBase, inst->fbd_TimeReq, &nowt);
 		waitt = nextt;
-		TExecSubTime(inst->fbd_ExecBase, &waitt, &nowt);
+		TSubTime(&waitt, &nowt);
 
 		TExecWaitTime(inst->fbd_ExecBase, inst->fbd_TimeReq, &waitt,
 			inst->fbd_CmdPortSignal);
@@ -479,16 +479,16 @@
 
 		/* check if time interval has expired: */
 		TExecGetSystemTime(inst->fbd_ExecBase, inst->fbd_TimeReq, &nowt);
-		if (TExecCmpTime(inst->fbd_ExecBase, &nowt, &nextt) > 0)
+		if (TCmpTime(&nowt, &nextt) > 0)
 		{
 			/* expired; send interval: */
 			do_interval = TTRUE;
-			TExecAddTime(inst->fbd_ExecBase, &nextt, &intt);
-			if (TExecCmpTime(inst->fbd_ExecBase, &nowt, &nextt) >= 0)
+			TAddTime(&nextt, &intt);
+			if (TCmpTime(&nowt, &nextt) >= 0)
 			{
 				/* nexttime expired already; create new time from now: */
 				nextt = nowt;
-				TExecAddTime(inst->fbd_ExecBase, &nextt, &intt);
+				TAddTime(&nextt, &intt);
 			}
 		}
 
diff -r 952ac202cdb9 -r ca74efba3806 src/exec/exec_time.c
--- a/src/exec/exec_time.c	Tue Jan 13 23:29:57 2009 +0100
+++ b/src/exec/exec_time.c	Wed Jan 14 00:43:53 2009 +0100
@@ -42,18 +42,16 @@
 */
 
 EXPORT void
-exec_GetSystemTime(struct TExecBase *TExecBase, struct TTimeRequest *tr, TTIME *timep)
+exec_GetSystemTime(struct TExecBase *TExecBase, struct TTimeRequest *tr,
+	TTIME *timep)
 {
-	if (tr)
+	if (tr && timep)
 	{
 		TAPTR saverp = tr->ttr_Req.io_ReplyPort;
 		tr->ttr_Req.io_ReplyPort = TNULL;


More information about the teklib-general mailing list