summaryrefslogtreecommitdiff
path: root/cpp/demo/Ice/async
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/demo/Ice/async')
-rw-r--r--cpp/demo/Ice/async/Client.cpp84
-rw-r--r--cpp/demo/Ice/async/WorkQueue.cpp60
-rw-r--r--cpp/demo/Ice/async/WorkQueue.h2
3 files changed, 73 insertions, 73 deletions
diff --git a/cpp/demo/Ice/async/Client.cpp b/cpp/demo/Ice/async/Client.cpp
index cb3e7e862c0..e164fb18cc3 100644
--- a/cpp/demo/Ice/async/Client.cpp
+++ b/cpp/demo/Ice/async/Client.cpp
@@ -54,8 +54,8 @@ AsyncClient::run(int argc, char* argv[])
HelloPrx hello = HelloPrx::checkedCast(communicator()->propertyToProxy("Hello.Proxy"));
if(!hello)
{
- cerr << argv[0] << ": invalid proxy" << endl;
- return EXIT_FAILURE;
+ cerr << argv[0] << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
}
menu();
@@ -63,40 +63,40 @@ AsyncClient::run(int argc, char* argv[])
char c;
do
{
- try
- {
- cout << "==> ";
- cin >> c;
- if(c == 'i')
- {
- hello->sayHello(0);
- }
- else if(c == 'd')
- {
- hello->sayHello_async(new AMI_Hello_sayHelloI, 5000);
- }
- else if(c == 's')
- {
- hello->shutdown();
- }
- else if(c == 'x')
- {
- // Nothing to do
- }
- else if(c == '?')
- {
- menu();
- }
- else
- {
- cout << "unknown command `" << c << "'" << endl;
- menu();
- }
- }
- catch(const Ice::Exception& ex)
- {
- cerr << ex << endl;
- }
+ try
+ {
+ cout << "==> ";
+ cin >> c;
+ if(c == 'i')
+ {
+ hello->sayHello(0);
+ }
+ else if(c == 'd')
+ {
+ hello->sayHello_async(new AMI_Hello_sayHelloI, 5000);
+ }
+ else if(c == 's')
+ {
+ hello->shutdown();
+ }
+ else if(c == 'x')
+ {
+ // Nothing to do
+ }
+ else if(c == '?')
+ {
+ menu();
+ }
+ else
+ {
+ cout << "unknown command `" << c << "'" << endl;
+ menu();
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ }
}
while(cin.good() && c != 'x');
@@ -125,10 +125,10 @@ void
AsyncClient::menu()
{
cout <<
- "usage:\n"
- "i: send immediate greeting\n"
- "d: send delayed greeting\n"
- "s: shutdown server\n"
- "x: exit\n"
- "?: help\n";
+ "usage:\n"
+ "i: send immediate greeting\n"
+ "d: send delayed greeting\n"
+ "s: shutdown server\n"
+ "x: exit\n"
+ "?: help\n";
}
diff --git a/cpp/demo/Ice/async/WorkQueue.cpp b/cpp/demo/Ice/async/WorkQueue.cpp
index 0493b8087ab..fc506938210 100644
--- a/cpp/demo/Ice/async/WorkQueue.cpp
+++ b/cpp/demo/Ice/async/WorkQueue.cpp
@@ -25,34 +25,34 @@ WorkQueue::run()
while(!_done)
{
if(_callbacks.size() == 0)
- {
- _monitor.wait();
- }
+ {
+ _monitor.wait();
+ }
- if(_callbacks.size() != 0)
- {
- //
- // Get next work item.
- //
- CallbackEntry entry = _callbacks.front();
+ if(_callbacks.size() != 0)
+ {
+ //
+ // Get next work item.
+ //
+ CallbackEntry entry = _callbacks.front();
- //
- // Wait for the amount of time indicated in delay to
- // emulate a process that takes a significant period of
- // time to complete.
- //
- _monitor.timedWait(IceUtil::Time::milliSeconds(entry.delay));
+ //
+ // Wait for the amount of time indicated in delay to
+ // emulate a process that takes a significant period of
+ // time to complete.
+ //
+ _monitor.timedWait(IceUtil::Time::milliSeconds(entry.delay));
- if(!_done)
- {
- //
- // Print greeting and send response.
- //
- _callbacks.pop_front();
- cout << "Belated Hello World!" << endl;
- entry.cb->ice_response();
- }
- }
+ if(!_done)
+ {
+ //
+ // Print greeting and send response.
+ //
+ _callbacks.pop_front();
+ cout << "Belated Hello World!" << endl;
+ entry.cb->ice_response();
+ }
+ }
}
//
@@ -79,17 +79,17 @@ WorkQueue::add(const Demo::AMD_Hello_sayHelloPtr& cb, int delay)
entry.cb = cb;
entry.delay = delay;
- if(_callbacks.size() == 0)
- {
+ if(_callbacks.size() == 0)
+ {
_monitor.notify();
- }
+ }
_callbacks.push_back(entry);
}
else
{
//
- // Destroyed, throw exception.
- //
+ // Destroyed, throw exception.
+ //
cb->ice_exception(Demo::RequestCanceledException());
}
}
diff --git a/cpp/demo/Ice/async/WorkQueue.h b/cpp/demo/Ice/async/WorkQueue.h
index 9147b2f615d..47c3ebf04da 100644
--- a/cpp/demo/Ice/async/WorkQueue.h
+++ b/cpp/demo/Ice/async/WorkQueue.h
@@ -33,7 +33,7 @@ private:
struct CallbackEntry
{
Demo::AMD_Hello_sayHelloPtr cb;
- int delay;
+ int delay;
};
IceUtil::Monitor<IceUtil::Mutex> _monitor;