avoid the racing condition

This commit is contained in:
Doug MacEachern 2008-08-09 16:30:05 +00:00
parent 46b48a5460
commit dd0dcc870d
1 changed files with 1 additions and 6 deletions

View File

@ -37,12 +37,7 @@ public class TestProcStat extends SigarTestCase {
long[] pids = sigar.getProcList(); long[] pids = sigar.getProcList();
//oh-no a racing condition! assertTrue(stat.getTotal() > 1);
//possible for this test to fail under normal
//conditions if the process table changes in between.
//if this is a real problem, can just change to:
//assertTrue(stat.getTotal() > 1);
assertTrue(pids.length == stat.getTotal());
traceln(stat.toString()); traceln(stat.toString());
SigarProxy proxy = SigarProxyCache.newInstance(getSigar()); SigarProxy proxy = SigarProxyCache.newInstance(getSigar());
traceln(CurrentProcessSummary.get(proxy).toString()); traceln(CurrentProcessSummary.get(proxy).toString());