Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
use std::exception in callback
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxihu committed Sep 16, 2019
1 parent 5ed5689 commit 5261f05
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions include/mxnet/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ class CallbackOnComplete {
public:
// use implicit copy and assign
/*! \brief involve the callback */
inline void operator()(const dmlc::Error* error = nullptr) const {
inline void operator()(const std::exception* error = nullptr) const {
(*callback_)(engine_, param_, error);
}

private:
/*! \brief engine can see content of callback */
friend class ::mxnet::Engine;
/*! \brief the real callback */
void (*callback_)(Engine *, void *, const dmlc::Error *);
void (*callback_)(Engine*, void*, const std::exception*);
/*! \brief the engine class passed to callback */
Engine* engine_;
/*! \brief the parameter set on callback */
Expand Down Expand Up @@ -279,7 +279,7 @@ class MXNET_API Engine {
* \param param the paramter passed to callback.
*/
inline CallbackOnComplete CreateCallback(
void (*callback)(Engine *, void *, const dmlc::Error *), void *param) {
void (*callback)(Engine*, void*, const std::exception*), void* param) {
CallbackOnComplete ret;
ret.callback_ = callback;
ret.engine_ = this;
Expand Down
4 changes: 2 additions & 2 deletions src/engine/naive_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ class NaiveEngine final : public Engine {

private:
// callback to oncomplete
static void OnComplete(Engine *engine, void *param,
const dmlc::Error* error) {
static void OnComplete(Engine* engine, void* param,
const std::exception* error) {
bool *req_completed = static_cast<bool*>(param);
*req_completed = true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/engine/threaded_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,8 @@ void ThreadedEngine::Throw(VarHandle var) {
ThrowException(threaded_var);
}

void ThreadedEngine::OnCompleteStatic(Engine *engine, void *opr_block_,
const dmlc::Error* error) {
void ThreadedEngine::OnCompleteStatic(Engine* engine, void* opr_block_,
const std::exception* error) {
OprBlock *opr_block = static_cast<OprBlock*>(opr_block_);
ThreadedOpr *threaded_opr = opr_block->opr;
if (error != nullptr) {
Expand Down
4 changes: 2 additions & 2 deletions src/engine/threaded_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,8 @@ class ThreadedEngine : public Engine {
}
}

static void OnCompleteStatic(Engine *engine, void *threaded_opr,
const dmlc::Error* error);
static void OnCompleteStatic(Engine* engine, void* threaded_opr,
const std::exception* error);
/*!
* \brief find exception in global_exception_refs and add it if missing
* \param opr_exception the exception to be added to global_exception_refs
Expand Down

0 comments on commit 5261f05

Please sign in to comment.