Skip to content

Commit

Permalink
added Signal() for invoking async callbacks without sending data from…
Browse files Browse the repository at this point in the history
… AsyncProgressWorker
  • Loading branch information
Joshua Wise committed Mar 14, 2016
1 parent 36058ff commit d8adba4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/asyncworker.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class AsyncProgressWorker : public AsyncWorker {
class ExecutionProgress {
public:
void Signal() const;
void Send(const char* data, size_t size) const;
};
Expand Down
3 changes: 3 additions & 0 deletions nan.h
Original file line number Diff line number Diff line change
Expand Up @@ -1632,6 +1632,9 @@ class Callback {
friend class AsyncProgressWorker;
public:
// You could do fancy generics with templates here.
void Signal() const {
uv_async_send(that_->async);
}
void Send(const char* data, size_t size) const {
that_->SendProgress_(data, size);
}
Expand Down
4 changes: 4 additions & 0 deletions test/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@
"target_name" : "asyncprogressworker"
, "sources" : [ "cpp/asyncprogressworker.cpp" ]
}
, {
"target_name" : "asyncprogressworkersignal"
, "sources" : ["cpp/asyncprogressworkersignal.cpp"]
}
, {
"target_name" : "nancallback"
, "sources" : [ "cpp/nancallback.cpp" ]
Expand Down

0 comments on commit d8adba4

Please sign in to comment.