|
@@ -82,11 +82,24 @@ namespace BBIWARG.Input.InputProviding
|
|
|
|
|
|
startId++;
|
|
startId++;
|
|
|
|
|
|
- wrapper = (IntelCameraWrapper) domain.CreateInstanceAndUnwrap(typeof(IntelCameraWrapper).Assembly.GetName().ToString(), typeof(IntelCameraWrapper).FullName);
|
|
|
|
|
|
+ Task startTask = null;
|
|
|
|
+ bool errorDuringInit = false;
|
|
|
|
|
|
- var startTask = Task.Run(() => wrapper.init(this));
|
|
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ wrapper = (IntelCameraWrapper)domain.CreateInstanceAndUnwrap(typeof(IntelCameraWrapper).Assembly.GetName().ToString(), typeof(IntelCameraWrapper).FullName);
|
|
|
|
+ startTask = Task.Run(() => wrapper.init(this));
|
|
|
|
+ errorDuringInit = startTask.Wait(TimeSpan.FromSeconds(4));
|
|
|
|
+ }
|
|
|
|
+ catch (Exception)
|
|
|
|
+ {
|
|
|
|
+ Console.WriteLine("Camera crashed while init");
|
|
|
|
+ errorstate = true;
|
|
|
|
+ scheduledForRestart = false;
|
|
|
|
+ errorDuringInit = true;
|
|
|
|
+ }
|
|
|
|
|
|
- if (!startTask.Wait(TimeSpan.FromSeconds(4)))
|
|
|
|
|
|
+ if (errorDuringInit)
|
|
{
|
|
{
|
|
Console.WriteLine("Timeout during init");
|
|
Console.WriteLine("Timeout during init");
|
|
errorstate = true;
|
|
errorstate = true;
|
|
@@ -105,7 +118,8 @@ namespace BBIWARG.Input.InputProviding
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- wrapper.run();
|
|
|
|
|
|
+ if(!errorDuringInit)
|
|
|
|
+ wrapper.run();
|
|
}
|
|
}
|
|
catch (System.AccessViolationException)
|
|
catch (System.AccessViolationException)
|
|
{
|
|
{
|
|
@@ -117,10 +131,6 @@ namespace BBIWARG.Input.InputProviding
|
|
Console.WriteLine("Camera Thread crashed.");
|
|
Console.WriteLine("Camera Thread crashed.");
|
|
errorstate = true;
|
|
errorstate = true;
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
checkExitErrorstate();
|
|
checkExitErrorstate();
|