Skip to content

Commit 7ccd1c8

Browse files
authored
Update README.md
1 parent e0bf1d6 commit 7ccd1c8

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Supports Windows, Linux and Mac OS X.
88
To catch Ctrl+C event/signal you should call:
99

1010
unsigned int CtrlCLibrary::SetCtrlCHandler(std::function<bool(enum CtrlSignal)> handler);
11+
1112
handler - custom handler;
1213

1314
**Return**:
@@ -16,7 +17,8 @@ Returns handler identifier, or CtrlCLibrary::kErrorID in case of error.
1617
To remove handler you should call:
1718

1819
void CtrlCLibrary::ResetCtrlCHandler(unsigned int id);
19-
id - handler identifier, returned by CtrlCLibrary::SetCtrlCHandler.
20+
21+
id - handler identifier, returned by CtrlCLibrary::SetCtrlCHandler.
2022

2123
### Installing
2224

@@ -38,23 +40,22 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
3840
## Notes
3941

4042
You can add a few handlers for Ctrl+C processing. All handlers will be called in LIFO order: first added handler will be called at last.
41-
Each handler should return bool value:
42-
43+
Each handler should return bool value:
4344
* *true* - to stop processing by other handlers;
4445
* *false* - to continue processing by other handlers (also, see notes for Windows below).
4546

46-
Library is thread-safe. *Warning*: You shouldn't remove handler from handler code. It will cause deadlock.
47+
The functions to set, reset and handle event are thread-safe. *Warning*: You shouldn't remove handler from handler code. It will cause deadlock.
4748

48-
####Errors####
49+
#### Errors
4950
Adding a new handler can return error id (kErrorID) in case of system error or lack of memory.
5051

51-
####Exceptions####
52-
The code process its errors (and any bad_alloc into SetCtrlCHandler call). In this case it will return error identifier (kErrorID).
52+
#### Exceptions
53+
The code processes its errors (and any bad_alloc into SetCtrlCHandler call). In this case it will return error identifier (kErrorID).
5354
Other exceptions aren't processed - you should catch them by your code.
5455

55-
####Linux notes####
56-
Adding any handler will cause a previous handler will not work. If first adding caused error, previous handler will not work too - OS will use DEFAULT handler.
57-
Removing of all handlers causes setting DEFAULT handler for Ctrl+C.
56+
#### Linux and Mac OS X notes
57+
Setting any handler will cause a previous handler will not work. If first setting causes error, previous handler will not work too - OS will use DEFAULT handler.
58+
Removing of all handlers causes set DEFAULT handler for Ctrl+C.
5859

59-
#### Windows notes####
60+
#### Windows notes
6061
If all handlers return **false**, a previous handler will be called. It can be default OS handler and your process will be closed.

0 commit comments

Comments
 (0)