void vector_sink_s_base::start() throw (CORBA::SystemException, CF::Resource::StartError)
{
    boost::mutex::scoped_lock lock(serviceThreadLock);
    if (serviceThread == 0) {
        if ( short_in ) short_in->unblock();
       	serviceThread = service_thread( this, 0.1);
        serviceThread->start();
    }
    
    if (!Resource_impl::started()) {
    	Resource_impl::start();
    }
}
void fft_filter_fff_base::start() throw (CORBA::SystemException, CF::Resource::StartError)
{
    boost::mutex::scoped_lock lock(serviceThreadLock);
    if (serviceThread == 0) {
        if ( float_in ) float_in->unblock();
       	serviceThread = service_thread( this, 0.1);
        serviceThread->start();
    }
    
    if (!Resource_impl::started()) {
    	Resource_impl::start();
    }
}
void add_ii_2i_base::start() throw (CORBA::SystemException, CF::Resource::StartError)
{
    boost::mutex::scoped_lock lock(serviceThreadLock);
    if (serviceThread == 0) {
        if ( data_in_0 ) data_in_0->unblock();
        if ( data_in_1 ) data_in_1->unblock();
       	serviceThread = service_thread( this, 0.1);
        serviceThread->start();
    }
    
    if (!Resource_impl::started()) {
    	Resource_impl::start();
    }
}
Exemplo n.º 4
0
void initialize_dbus(void)
{
    dbus_threads_init_default();

    DBusError error;
    dbus_error_init(&error);

    // Initialize service bus
    service_bus = dbus_connection_open(SERVICE_BUS_ADDRESS, &error);
    if (!service_bus) {
        errx(1, "failed to connect to service bus: %s: %s\n", error.name, error.message);
    }

    if (!dbus_bus_register(service_bus, &error)) {
        errx(1, "failed to register with service bus: %s: %s\n", error.name, error.message);
    }

    // Initialize HMI bus
    hmi_bus = dbus_connection_open(HMI_BUS_ADDRESS, &error);
    if (!hmi_bus) {
        errx(1, "failed to connect to HMI bus: %s: %s\n", error.name, error.message);
    }

    if (!dbus_bus_register(hmi_bus, &error)) {
        errx(1, "failed to register with HMI bus: %s: %s\n", error.name, error.message);
    }

    std::thread service_thread([]() {
        while (dbus_connection_read_write_dispatch(service_bus, -1));
    });

    std::thread hmi_thread([]() {
        while (dbus_connection_read_write_dispatch(hmi_bus, -1));
    });

    service_thread.detach();
    hmi_thread.detach();
}
Exemplo n.º 5
0
void* IConnectionHandler::handleRequests(void* arg) {
	IConnectionHandler* handler = (IConnectionHandler*)arg;
	map<int, bool>::iterator it;
	while (true) {
		Thread::mSleep(1);
		for (it = handler->fds.begin(); it != handler->fds.end(); it++) {
			if (handler->reader->q.find(it->first) != handler->reader->q.end()
					&& !handler->reader->q[it->first].empty()) {
				string data = handler->reader->q[it->first].front();
				handler->reader->q[it->first].pop();
				if (data.length()>0) {
					RequestProp *requestProp = new RequestProp();
					requestProp->fd = it->first;
					requestProp->handler = handler;
					requestProp->data = data;

					Thread service_thread(&service, requestProp);
					service_thread.execute();
				}
			}
		}
	}
	return NULL;
}