Added "synchronized" method to create random number in case of multi-thread issue
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1722 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -148,7 +148,7 @@ public class Tool implements EfiDefine, Section {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.outputFileName = "Temp" + ran.nextInt();
|
this.outputFileName = "Temp" + getRand();
|
||||||
argument = toolArgList + inputFiles.toStringWithSinglepPrefix(" -i ")
|
argument = toolArgList + inputFiles.toStringWithSinglepPrefix(" -i ")
|
||||||
+ tempInputFile.toString(" ")+ " -o " + outputFileName;
|
+ tempInputFile.toString(" ")+ " -o " + outputFileName;
|
||||||
EdkLog.log(this, EdkLog.EDK_VERBOSE, command + " " + argument);
|
EdkLog.log(this, EdkLog.EDK_VERBOSE, command + " " + argument);
|
||||||
@ -164,7 +164,8 @@ public class Tool implements EfiDefine, Section {
|
|||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
EdkLog.log(e.getMessage());
|
||||||
throw new BuildException("Execution of externalTool task failed!\n");
|
throw new BuildException("Execution of externalTool task failed!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,6 +238,15 @@ public class Tool implements EfiDefine, Section {
|
|||||||
public void addGenSection(GenSectionTask genSect){
|
public void addGenSection(GenSectionTask genSect){
|
||||||
this.gensectList.add(genSect);
|
this.gensectList.add(genSect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get random number.
|
||||||
|
|
||||||
|
@returns The random integer.
|
||||||
|
**/
|
||||||
|
public synchronized int getRand() {
|
||||||
|
return ran.nextInt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user