Presentation

A SeD does not necessarily need to declare all its services initially, i.e., as presented in Chapter 5 before launching the SeD via diet_SeD(...). One could want to initially declare a given set of services, and then, depending on parameters, or external events, one could want to modify this set of services. An example of such usage is to spawn a service that is in charge of cleaning temporary files when they won't be needed nor by this SeD, nor by any other SeD or clients, and when this service is called, it cleans whatever needs to be cleaned, and then this service is removed from the service table.

Adding a service has already been introduced in Chapter 5: using diet_service_table_add(...) you can easily add a new service (be it before running the SeD or within a service). Well, removing a service is as easy, you only need to call one of these methods:

int diet_service_table_remove(const diet_profile_t* const profile);
int diet_service_table_remove_desc(const diet_profile_desc_t* const profile);

So basically, when you want to remove the service that is called, you only need to pass the diet_profile_t you receive in the solve function to diet_service_table_remove. If you want to remove another service, you need to build its profile description (just as if you wanted to create a new service), and pass it to diet_service_table_remove_desc.

The DIET Team - Mer 29 nov 2017 15:13:36 EST