Update delle libs esterne x chiamata
This commit is contained in:
+17
-2
@@ -21,13 +21,16 @@ builder.Services.AddControllers();
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
ExecProcessManager? myExecProcessManager = null;
|
||||
|
||||
// solo se abilitato da conf
|
||||
if (enableEgwEng)
|
||||
{
|
||||
// aggiungo rif libreria EgwManager
|
||||
string sCamExePath = @"c:\EgtProg\EgtEngine\EgtEngineR32.exe";
|
||||
string sMainLuaPath = @"c:\Temp\EgwMultiEngineManager\Pipe.lua";
|
||||
ExecProcessManager myExecProcessManager = new ExecProcessManager(sCamExePath, sMainLuaPath, 1, ExecProcessManager.ReturnModes.EVENT_);
|
||||
myExecProcessManager = new ExecProcessManager(sCamExePath, sMainLuaPath, 1, ExecProcessManager.ReturnModes.EVENT_);
|
||||
myExecProcessManager.StartExecutionThread();
|
||||
builder.Services.AddSingleton<ExecProcessManager>(myExecProcessManager);
|
||||
}
|
||||
builder.Services.AddSingleton<ImageCacheService>();
|
||||
@@ -52,4 +55,16 @@ app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
// inserisco evento in chiusura x fermare i thread di calcolo sottostanti:
|
||||
// https://shazwazza.com/post/aspnet-core-application-shutdown-events/
|
||||
// https://dotnetblog.asphostportal.com/how-to-handle-application-shutdown-in-asp-net-core/
|
||||
app.Lifetime.ApplicationStopping.Register(() =>
|
||||
{
|
||||
if (myExecProcessManager != null)
|
||||
{
|
||||
myExecProcessManager.StopExecutionThread();
|
||||
}
|
||||
});
|
||||
|
||||
// avvio app
|
||||
app.Run();
|
||||
Reference in New Issue
Block a user