Update README.md

master
漪綿 清烛 5 years ago committed by GitHub
parent 7e321c901f
commit 6a7df6e126
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 38
      docs/ovo_Timer/README.md

@ -0,0 +1,38 @@
## Class Timer
**To use this class, you need to put `#define _pthread` before your `#include "ovo.h"` **
**And also, use `g++ yourCode.cpp -std=c++14 -pthread` to compile**
---------
### Timer.setTimeout()
This can let your be executed after certain time.
#### Params:
- **auto function** Your function. `Lambda Expression is allowed!`
- **int delay** Time to delay in milliseconds.
#### Example
````C++
#include <iostream>
#include <string>
#define _pthread
#include "ovo.h"
using namespace std;
void display(){
cout << "Hey.. After 1s." << endl;
}
int main()
{
ovo::Timer t = ovo::Timer();
t.setsetTimeout(dis, 1000);
while (1); //Keep the main thread never stop
return 0;
}
````
This will get the following result. (Use Ctrl+C to interrupt)
>Hey.. After 1s.
Loading…
Cancel
Save