@@ -12,16 +12,17 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
See the License for the specific language governing permissions and
13
13
limitations under the License. */
14
14
15
- #include < boost/tokenizer.hpp>
16
15
#include < memory>
17
- #include < thread>
16
+ #include < thread> // NOLINT
18
17
#include < vector>
19
18
#include " paddle/fluid/framework/channel.h"
20
19
#include " paddle/fluid/framework/executor.h"
21
20
#include " paddle/fluid/framework/lod_tensor.h"
22
21
#include " paddle/fluid/framework/op_registry.h"
23
22
#include " paddle/fluid/operators/concurrency/channel_util.h"
24
23
24
+ #include < boost/tokenizer.hpp>
25
+
25
26
namespace paddle {
26
27
namespace operators {
27
28
@@ -254,8 +255,8 @@ class SelectOp : public framework::OperatorBase {
254
255
auto selectCond = std::make_shared<std::condition_variable_any>();
255
256
256
257
std::recursive_mutex callbackMutex;
257
- pushThreadOnChannelQueues (scope, cases, selectCond, caseToExecute,
258
- completed, callbackMutex);
258
+ pushThreadOnChannelQueues (scope, cases, selectCond, & caseToExecute,
259
+ & completed, & callbackMutex);
259
260
260
261
// TODO(thuan): Atomically unlock all channels and sleep current thread
261
262
unlockChannels (channels);
@@ -302,8 +303,8 @@ class SelectOp : public framework::OperatorBase {
302
303
const framework::Scope *scope,
303
304
std::vector<std::shared_ptr<SelectOpCase>> *cases,
304
305
std::shared_ptr<std::condition_variable_any> rCond,
305
- std::atomic<int > & caseToExecute, std::atomic<bool > & completed,
306
- std::recursive_mutex & callbackMutex) const {
306
+ std::atomic<int > * caseToExecute, std::atomic<bool > * completed,
307
+ std::recursive_mutex * callbackMutex) const {
307
308
std::vector<std::shared_ptr<SelectOpCase>>::iterator it = cases->begin ();
308
309
while (it != cases->end ()) {
309
310
std::shared_ptr<SelectOpCase> c = *it;
@@ -315,17 +316,17 @@ class SelectOp : public framework::OperatorBase {
315
316
std::function<bool (framework::ChannelAction channelAction)> cb =
316
317
[&caseToExecute, &completed, &callbackMutex,
317
318
c](framework::ChannelAction channelAction) {
318
- std::lock_guard<std::recursive_mutex> lock{callbackMutex};
319
+ std::lock_guard<std::recursive_mutex> lock{* callbackMutex};
319
320
320
321
bool canProcess = false ;
321
- if (!completed) {
322
+ if (!(* completed) ) {
322
323
// If the channel wasn't closed, we set the caseToExecute index
323
324
// as this current case
324
325
if (channelAction != framework::ChannelAction::CLOSE) {
325
- caseToExecute = c->caseIndex ;
326
+ * caseToExecute = c->caseIndex ;
326
327
}
327
328
// This will allow our conditional variable to break out of wait
328
- completed = true ;
329
+ * completed = true ;
329
330
canProcess = true ;
330
331
}
331
332
0 commit comments