Example #1
0
void register_objects(CORBA_ORB o, CORBA_BOA b, int argc, char **argv,
		      CORBA_Environment *ev)
{
	int i;
	
	/* Save our ORB and BOA handles for later use. */
	orb = o;
	boa = b;
	
	pb_impl_list = 0;
	
	for (i = 1; i < argc; i++) {
		if (!strcmp(argv[i], "-I") && (i + 1 < argc)) {
			CORBA_ReferenceData id;
			data_phonebook obj;
			impl_node list = pb_impl_list;
			
			obj = CORBA_BOA_create(boa, &id, 
					       "data::phonebook",
					       &data_phonebook_server,
					       ev);
			if (ev->_major != CORBA_NO_EXCEPTION)
				return;
			
			pb_impl_list = (impl_node)
				       malloc(sizeof(*pb_impl_list));
			if (!pb_impl_list) {
				signal_no_memory(ev);
				return;
			}
			
			pb_impl_list->id = id;
			pb_impl_list->obj = obj;
			pb_impl_list->pb = 0;
			pb_impl_list->pb_elems = 0;
			pb_impl_list->pb_size = 0;
			pb_impl_list->next = list;
		}
	}
	
	/* Signal failure if no objects were registered. */
	if (!pb_impl_list) {
		signal_initialize(ev);
		return;
	}
	
	/*
	 * It is not necessary to signal ``no exception'' explicitly, but we
	 * do so just to be pedantic.
	 */
	CORBA_BOA_set_exception(boa, ev, CORBA_NO_EXCEPTION, 0, 0);
}
Example #2
0
void ja_master_wait(JaMaster * master)
{
    signal_initialize();
    GList *children = master->children;
    int status;
    while (1) {
        pid_t pid = wait(&status);
        if (pid > 0) {
            g_warning("server %d: status %d", pid, status);
            JaRunningServer *server =
                ja_running_servers_find(children, pid);
            if (server && server->running) {
                server->pid = ja_server_create(server->name, master->cfg);
            }
        } else if (pid < 0 && errno == ECHILD) {
            break;
        }
    }
    g_list_free_full(master->children,
                     (GDestroyNotify) ja_running_server_free);
    master->children = NULL;
}