forb_t *forb = forb_object_to_forb(orb);
forb_port_t *port;
forb_regref_t *regref;
+ forb_object obj;
+
+ /* Destroy ports to prevent remote requests from coming */
+ ul_list_for_each_cut(forb_port, forb, port) {
+ forb_destroy_port(port);
+ }
+
+ /* Wait for executors to finish all requests (and thus close
+ * connections to peers). This is very inefficient for big
+ * number of objects, but we do not care */
+ gavl_cust_for_each(forb_objects_nolock, forb, obj) {
+ forb_executor_t *executor;
+ executor = forb_object_get_executor(obj);
+ if (executor)
+ forb_executor_synchronize(executor);
+ }
pthread_cancel(forb->execution_thread.pthread_id);
pthread_join(forb->execution_thread.pthread_id, NULL);
forb_unregister_reference(orb, regref->name.str);
}
- ul_list_for_each_cut(forb_port, forb, port) {
- forb_destroy_port(port);
- }
forb_object_release(orb);
forb_free(forb);
}