You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Asynchronous calls are mechanisms to execute actions in a decoupled fashion. There are different approaches for asynchronous calls, depending on the level of control that is required. Some of them are offered by CORBA, ACS and BACI implementations. For instance we have:

  • threading: Programming Language feature
  • queuing: Design/Programming Language
  • oneway: CORBA functionality
  • offshoot: ACS functionality
  • callbacks: offshoot specialization by ACS
  • actions: BACI implementation based on callbacks

Asynchronous Mechanism

Threading

One approach for asynchronous calls based on the programming language functionality, is simply to use threading inside a method call, to execute the action in a separate thread and to return instantaneously.

void calibrateSync() {
  // do calibration...
}

void ExampleImpl::calibrate() {
    std::thread first(calibrateSync);
}

Queuing

A second approach based on design and programming language alone, is to populate queues with the actions that will be orchestrated by a separate thread.

void calibrateSync() {
    // do calibration...
}


//Function running on some other thread...
void run() {
    while (!stop) {
        if (queue.size() > 0) {
            if (queue.pop() == CALIBRATE_ACTION) {
                calibrateSync();
            } else {
                //Some error
            }
        }
    }
}
void ExampleImpl::calibrate() {
    queue.push(CALIBRATE_ACTION);
}

Oneway

Oneway is a concept in CORBA that is defined as a keyword in the IDL interface methods, which makes sure the caller continues with the execution without waiting for anything from the client. This is similar to threading/queuing options, but is stronger, in the sense that it is not possible to receive a return value nor to raise an exception.

interface Example: ... {
    ...
    oneway void calibrate();
    ...
}
void ExampleImpl::calibrate() {
    // do calibration...
}

Reporting on Asynchronous Calls

Offshoots

Callbacks

BACI Actions

  • No labels