add WINIX_PLUGIN_QUIT and WINIX_QUIT plugins messages

While here:
- rename WINIX_CLOSE to WINIX_PREPARE_TO_CLOSE
This commit is contained in:
Tomasz Sowa 2022-04-25 16:34:26 +02:00
parent 92c7f90b95
commit 43ebbdaa33
3 changed files with 24 additions and 4 deletions

View File

@ -408,7 +408,7 @@ void App::Close()
{ {
Winix::Lock lock(synchro); Winix::Lock lock(synchro);
plugin.Call((Winix::Session*)0, WINIX_CLOSE); plugin.Call((Winix::Session*)0, WINIX_PREPARE_TO_CLOSE);
session_manager.SaveSessions(); session_manager.SaveSessions();
session_manager.DeleteSessions(); session_manager.DeleteSessions();
@ -421,6 +421,17 @@ void App::Close()
WaitForThreads(); WaitForThreads();
// now all others threads are terminated // now all others threads are terminated
/*
* at the moment plugins are removed when winix is finishing
* but in the future we can add plug-in removal before the end
*/
plugin.Call(nullptr, WINIX_PLUGIN_QUIT);
/*
* this is the last message for plugins
*/
plugin.Call(nullptr, WINIX_QUIT);
} }

View File

@ -107,10 +107,14 @@ namespace Winix
// in l1 you have the old session id // in l1 you have the old session id
#define WINIX_SESSION_REMOVED 30029 #define WINIX_SESSION_REMOVED 30029
// the winix is closing // the winix is being closing
// there is not any sessions available (cur->session is null) // there is not any sessions available (cur->session is null)
// session pointer is null // session pointer is null
#define WINIX_CLOSE 30040 #define WINIX_PREPARE_TO_CLOSE 30040
// winix has been closes, all other threads are stopped now, this is a last message for the main thread
// there is not any sessions available (cur->session is null)
#define WINIX_QUIT 30041
// preparing to remove a file (rm function) // preparing to remove a file (rm function)
// in p1 you have a pointer to the Item struct (file) // in p1 you have a pointer to the Item struct (file)
@ -142,6 +146,11 @@ namespace Winix
// session pointer is null // session pointer is null
#define WINIX_PLUGIN_INIT 30080 #define WINIX_PLUGIN_INIT 30080
// winix is ready to remove a plugin
// you can clear some plugin data here e.g. controllers
// all other threads are stopped now
#define WINIX_PLUGIN_QUIT 30081
// here you can add your own mount point, file systems, mount parameters // here you can add your own mount point, file systems, mount parameters
// for adding a new mount type call: system->mounts.AddMountType("new_mount_name") // for adding a new mount type call: system->mounts.AddMountType("new_mount_name")
// session pointer is null // session pointer is null

View File

@ -230,7 +230,7 @@ using namespace Stats;
info.plugin->Assign(WINIX_CONTENT_MAKE, ContentMake); info.plugin->Assign(WINIX_CONTENT_MAKE, ContentMake);
info.plugin->Assign(WINIX_SESSION_CREATED, SessionCreated); info.plugin->Assign(WINIX_SESSION_CREATED, SessionCreated);
info.plugin->Assign(WINIX_PLUGIN_SESSION_DATA_REMOVE, RemoveSession); info.plugin->Assign(WINIX_PLUGIN_SESSION_DATA_REMOVE, RemoveSession);
info.plugin->Assign(WINIX_CLOSE, Close); info.plugin->Assign(WINIX_PREPARE_TO_CLOSE, Close);
info.plugin->Assign(WINIX_FILE_REMOVED, RemoveFile); info.plugin->Assign(WINIX_FILE_REMOVED, RemoveFile);
info.plugin->Assign(WINIX_DIR_PREPARE_TO_REMOVE, RemoveDir); info.plugin->Assign(WINIX_DIR_PREPARE_TO_REMOVE, RemoveDir);