Bladeren bron

identified a potential problem

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@7126 8c9fc860-2736-0410-a75d-ab315db34111
skoster 8 jaren geleden
bovenliggende
commit
0842a0c444
2 gewijzigde bestanden met toevoegingen van 6 en 1 verwijderingen
  1. 4 1
      source/Unix.HierarchicalProfiler0.Mod
  2. 2 0
      source/Win32.HierarchicalProfiler0.Mod

+ 4 - 1
source/Unix.HierarchicalProfiler0.Mod

@@ -72,6 +72,7 @@ TYPE
 				Objects.GetCpuCycles(process, cycles, FALSE); 
 				times[i] := cycles[0];
 				(*TRACE(process,me,cycles[0],process.mode,Objects.Running);*)
+				(*the damned thing might go into waiting or some other unwanted state before we suspend it todo*)
 				IF (process # me) & (cycles[0] # 0)  & (process.mode = Objects.Running) (* (process.mode # Objects.AwaitingEvent) & (process.mode # Objects.AwaitingCond)  & (process.mode < Objects.Suspended) & (process.mode >= Objects.Ready)  (*RanMeanwhile(process, times[i]) *) *) THEN
 					HandleProcess(process);
 				END;
@@ -122,12 +123,13 @@ BEGIN
 	ASSERT(process # NIL);
 	threadId:=process.threadId;
 	
-	(*from check at callsite it's guaranteed that the process is running (mode=Objects.Running) *)
 	
 	(*todo: validate thread ID*)
 	TRACE('suspending thread',threadId);
 	Unix.ThrSuspend(threadId);
 	(*because thread suspending is under a mutex in Unix.Mod, this call is guaranteed to have finished with the handler when it returns.*)
+	TRACE('suspend successful',threadId);
+	
 	context:=process.context;
 	IF (context.r_pc #0) THEN
 		stackBottom:=Objects.GetStackBottom(process);
@@ -201,5 +203,6 @@ HierarchicalProfiler.Show~
 SystemTools.Free WMProfiler HierarchicalProfiler HierarchicalProfiler0 ~
 
 Test.Busyloop~
+Test.PingPongTest~
 
 Debugging.DisableGC~

+ 2 - 0
source/Win32.HierarchicalProfiler0.Mod

@@ -154,3 +154,5 @@ END HierarchicalProfiler0.
 WMProfiler.Open
 
 SystemTools.Free WMProfiler HierarchicalProfiler HierarchicalProfiler0 ~
+
+Debugging.DisableGC~