fosa_mutex_t regref_mutex;
gavl_cust_root_field_t regrefs; /**< Container for ::forb_regref_t */
- fosa_thread_id_t execution_thread; /**< Thread which executes remote requests for this forb::orb interface. */
+ fosa_thread_id_t execution_thread; /**< Thread which runs @a default_executor. */
+ forb_executor_t default_executor; /**< Executor that executes remote requests for this forb::orb interface. */
} forb_t;
typedef void (*forb_skel_func)(FORB_CDR_Codec *cin,
static void *
forb_execution_thread(void *arg)
{
- forb_orb orb = arg;
-
- forb_execute_object(orb);
+ forb_executor_t *executor = arg;
+ forb_executor_run(executor);
return NULL;
}
* can accept remote request to our new ORB. */
forb_objects_nolock_insert(forb, orb);
+ ret = forb_executor_init(&forb->default_executor);
+ if (ret) goto err2;
+ ret = forb_executor_register_object(&forb->default_executor, orb);
+ if (ret) goto err3;
+
ret = fosa_thread_create(&forb->execution_thread, NULL,
- forb_execution_thread, orb);
+ forb_execution_thread, &forb->default_executor);
if (ret != 0)
- goto err2;
+ goto err3;
/* FIXME: I do not know how to deregister the exit handler if
* forb_destroy() is called manually. */
}
err_free_unix:
free(port);
- goto err2;
+ goto err3;
unix_ok:;
}
#endif
}
err_free_inet:
free(port);
- goto err2;
+ goto err3;
inet_ok:;
hack_register_fcb(orb, port);
}
#endif
return orb;
+err3: forb_executor_destroy(&forb->default_executor);
err2: forb_free(forb);
err: return NULL;
}
forb_orb orb;
bool opt_daemon = false;
char *opt_pidfile = NULL;
- int i;
+ int i, ret;
forb_init_attr_t attr = {
.orb_id = "",
.peer_discovery_callback = NULL, /* TODO */
exit(0);
}
{
- int ret;
ret = ul_log_domain_arg2levels(optarg);
if (ret)
error(1, EINVAL, "Error parsing -l argument at char %d\n", ret);
fosa_thread_create(&tid, NULL, forb_main_thread, data);
libs_loaded_cnt++;
- forb_wait_for_server_ready(orb);
+ ret = forb_wait_for_server_ready(orb);
+ if (ret)
+ error(1, errno, "forb_wait_for_server_ready");
}
if (opt_daemon)
#include <forb.h>
#include <stdio.h>
+#include <error.h>
int forb_main(forb_orb orb, int argc, char *argv[])
{
- int i;
+ int i, ret;
for (i=0; i<argc; i++)
printf("%s%s", argv[i], i+1 < argc ? " " : "");
printf("\n");
if (argc < 2 || strcmp(argv[1], "--exit") != 0) {
/* Allow starting the next shared library */
- forb_signal_server_ready(orb);
+ ret = forb_signal_server_ready(orb);
+ if (ret)
+ error(1, errno, "forb_signal_server_ready");
/* Exit only this thread, not the whole forbrun */
pthread_exit(0);
}