InterruptCB

typedef struct InterruptCB {
  int (*callback)(void*);
  void *opaque;
} InterruptCB;

class Parse{
 public:
  static int InterruptCallBack(void* ctx) {
    Parse* parse = reinterpret_cast<Parse*>(ctx);
    if (parse) {
      // do something 
      return 1;
    } 
    return 0;
  }

  int Open() {
    intrpt_callback = {InterruptCallBack, this};
  }
 private:
  InterruptCB intrpt_callback; 
}; // class Parse
posted @ 2020-12-29 16:59  cyssmile  阅读(81)  评论(0编辑  收藏  举报