@@ -59,19 +59,6 @@ void asyncNullOperation(bdlmt::ThreadPool* threadPool,
5959 threadPool->enqueueJob (callback);
6060}
6161
62- // / Invoke the specified completion `callback` on the specified `threadPool`
63- // / with the specified `operationId` parameter.
64- void asyncIdentifiableOperation (bdlmt::ThreadPool* threadPool,
65- unsigned operationId,
66- const bsl::function<void (unsigned )>& callback)
67- {
68- // PRECONDITIONS
69- BSLS_ASSERT (threadPool);
70- BSLS_ASSERT (callback);
71-
72- threadPool->enqueueJob (bdlf::BindUtil::bind (callback, operationId));
73- }
74-
7562// / Return a `bsls::TimeInterval` object encoding a point in time the
7663// / specified number of `seconds` from now, according to the monotonic
7764// / clock.
@@ -241,25 +228,24 @@ struct UsageExample {
241228 // TYPES
242229 typedef bsl::function<void ()> SendCallback;
243230
244- typedef bsl::function<void (int clientId, int payload )> ReceiveCallback;
231+ typedef bsl::function<void ()> ReceiveCallback;
245232
246233 // CLASS FUNCTIONS
247234
248235 // / Callback invoked on completion of a `send` operation.
249236 static void onDataSent ();
250237
251238 // / Callback invoked on completion of a `receive` operation.
252- static void onDataReceived (int clientId, int payload );
239+ static void onDataReceived ();
253240
254241 // / Send the specified `payload` to the client identified by the
255242 // / specified `clientId` and invoke the specified
256243 // / `completionCallback` when the payload is sent.
257244 static void
258245 send (int clientId, int payload, const SendCallback& completionCallback);
259246
260- // / Receive a payload send to us by another client and invoke the
261- // / specified `completionCallback` with the payload and the sender
262- // / client ID.
247+ // / Receive a payload from another client and invoke the specified
248+ // / `completionCallback` when done.
263249 static void receive (const ReceiveCallback& completionCallback);
264250};
265251
@@ -273,7 +259,7 @@ inline void UsageExample::onDataSent()
273259 // NOTHING
274260}
275261
276- inline void UsageExample::onDataReceived (int , int )
262+ inline void UsageExample::onDataReceived ()
277263{
278264 // NOTHING
279265}
@@ -286,7 +272,7 @@ UsageExample::send(int, int, const SendCallback& completionCallback)
286272
287273inline void UsageExample::receive (const ReceiveCallback& completionCallback)
288274{
289- completionCallback (0 , 0 );
275+ completionCallback ();
290276}
291277
292278// ============================================================================
@@ -412,13 +398,10 @@ static void test3_chain_startStop(bdlmt::ThreadPool* threadPool)
412398 for (unsigned operationId = 0 ; operationId < k_NUM_OPERATIONS;
413399 ++operationId) {
414400 chain.appendInplace (
415- bdlf::BindUtil::bind (&asyncIdentifiableOperation ,
401+ bdlf::BindUtil::bind (&asyncNullOperation ,
416402 threadPool,
417- operationId,
418403 bdlf::PlaceHolders::_1),
419- bdlf::BindUtil::bind (PushBack (),
420- &completionIds,
421- bdlf::PlaceHolders::_1));
404+ bdlf::BindUtil::bind (PushBack (), &completionIds, operationId));
422405 }
423406
424407 // make sure operation haven't started executing
@@ -458,15 +441,13 @@ static void test3_chain_startStop(bdlmt::ThreadPool* threadPool)
458441 // add several operations
459442 for (unsigned operationId = 0 ; operationId < k_NUM_OPERATIONS;
460443 ++operationId) {
461- chain.appendInplace (
462- bdlf::BindUtil::bind (&asyncIdentifiableOperation,
463- threadPool,
464- operationId,
465- bdlf::PlaceHolders::_1),
466- bdlf::BindUtil::bind (PushBackSynchronize (),
467- &semaphore,
468- &completionIds,
469- bdlf::PlaceHolders::_1));
444+ chain.appendInplace (bdlf::BindUtil::bind (&asyncNullOperation,
445+ threadPool,
446+ bdlf::PlaceHolders::_1),
447+ bdlf::BindUtil::bind (PushBackSynchronize (),
448+ &semaphore,
449+ &completionIds,
450+ operationId));
470451 }
471452
472453 // no executing operations
@@ -524,13 +505,12 @@ static void test4_chain_join(bdlmt::ThreadPool* threadPool)
524505 // add several operations
525506 for (unsigned operationId = 0 ; operationId < k_NUM_OPERATIONS;
526507 ++operationId) {
527- chain.appendInplace (bdlf::BindUtil::bind (&asyncIdentifiableOperation ,
508+ chain.appendInplace (bdlf::BindUtil::bind (&asyncNullOperation ,
528509 threadPool,
529- operationId,
530510 bdlf::PlaceHolders::_1),
531511 bdlf::BindUtil::bind (PushBackRndSleep (),
532512 &completionIds,
533- bdlf::PlaceHolders::_1 ));
513+ operationId ));
534514 }
535515
536516 // start executing
@@ -1102,13 +1082,12 @@ static void test10_chain_serialization(bdlmt::ThreadPool* threadPool)
11021082 for (unsigned i = 0 ; i < k_NUM_LINKS; ++i) {
11031083 for (unsigned j = 0 ; j < k_NUM_OPERATIONS; ++j) {
11041084 unsigned operationId = i * k_NUM_OPERATIONS + j;
1105- link.insert (bdlf::BindUtil::bind (&asyncIdentifiableOperation ,
1085+ link.insert (bdlf::BindUtil::bind (&asyncNullOperation ,
11061086 threadPool,
1107- operationId,
11081087 bdlf::PlaceHolders::_1),
11091088 bdlf::BindUtil::bind (PushBackRndSleep (),
11101089 &completionIds,
1111- bdlf::PlaceHolders::_1 ));
1090+ operationId ));
11121091 }
11131092
11141093 chain.append (&link);
0 commit comments