]> rtime.felk.cvut.cz Git - frescor/frsh.git/blobdiff - frsh_api/frsh_core.c
Destroy forb in the correct order
[frescor/frsh.git] / frsh_api / frsh_core.c
index 084e691620b88931b5927e93e210e080504a8f7f..1e17525f152f9aced0f34833df4e2e46ece28f82 100644 (file)
@@ -118,8 +118,9 @@ int frsh_init()
        ret = forb_executor_init(&frsh_forb_global.alloc_executor);
        if (ret) goto err;
 
-       fra_registry_init(frsh_forb_global.orb, frsh_forb_global.fcb,
-                         &frsh_forb_global.alloc_executor);
+       ret = fra_registry_init(frsh_forb_global.orb, frsh_forb_global.fcb,
+                               &frsh_forb_global.alloc_executor);
+       if (ret) goto err;
        
 #ifdef CONFIG_AQUOSA
        ret = aqcpu_fra_init();
@@ -158,8 +159,31 @@ err:
        return ret;
 }
 
+void frsh_destroy()
+{
+       forb_destroy(frsh_forb_global.orb);
+       
+       pthread_cancel(frsh_forb_global.alloc_executor_thread.pthread_id);
+       pthread_join(frsh_forb_global.alloc_executor_thread.pthread_id, NULL);
+
+       /* TODO: Destroy all FRAs etc. */
+}
+
+
+
 bool frsh_config_is_admission_test_enabled()
 {
        return true;
 }
 
+frsh_resource_id_t frsh_get_local_cpu_id(void)
+{
+       long int ret =  FRSH_CPU_ID_DEFAULT;
+       if (getenv("FRSH_CPU_ID")) {
+               errno = 0;      /* See strtol(1) */
+               ret = strtol(getenv("FRSH_CPU_ID"), NULL, 10);
+               if (errno != 0)
+                       ret = FRSH_CPU_ID_DEFAULT;
+       }
+       return ret;
+}