Skip to content

Commit

Permalink
Update about-counter.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Barenboim authored Sep 24, 2024
1 parent 4bc8e56 commit 774d687
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/en/about-counter.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,17 @@ In the example, a counter named "c1" is created, and in the HTTP callback, call
class WFTaskFactory
{
...
static void count_by_name(const std::string& counter_name);
static int count_by_name(const std::string& counter_name);

static void count_by_name(const std::string& counter_name, unsigned int n);
static int count_by_name(const std::string& counter_name, unsigned int n);
...
};
~~~

You can pass an integer n to **WFTaskFactory::count\_by\_name**, indicating the count value to be increased in this operation. Obviously:
**count\_by\_name("c1")** is equivalent to **count\_by\_name("c1", 1)**.
If the "c1" counter does not exist (not created or already completed), the operation on "c1" will have no effect, so the wild pointer problem in an anonymous counter will not happen here.
If the "c1" counter does not exist (not created or already completed), the operation on "c1" will have no effect, so the wild pointer problem in an anonymous counter will not happen here.
The **count\_by\_name()** function returns the number of counters that was waked up by the operation. When **n** is greater that 1, more than one counter may reach target value.

# Definition of the detailed behaviors of named counters

Expand Down

0 comments on commit 774d687

Please sign in to comment.