Timer library fixes.

This commit is contained in:
Abhishek Sagar
2023-06-18 08:57:23 +00:00
parent b69ddcdb96
commit a504fff911
3 changed files with 64 additions and 4 deletions

59
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,59 @@
bitmap{
"git.ignoreMissingGitWarning": true,
"remote.SSH.remotePlatform": {
"192.168.216.128": "linux"
},
"terminal.integrated.fontFamily": "courier new",
"terminal.integrated.drawBoldTextInBrightColors": false,
"terminal.integrated.minimumContrastRatio": 4.5,
"workbench.colorTheme": "Default High Contrast",
"terminal.integrated.rightClickBehavior": "paste",
"terminal.integrated.copyOnSelection": true,
"git.ignoreLegacyWarning": true,
"editor.renderControlCharacters": true,
"editor.rulers": [
120
],
"editor.fontFamily": "comicsans, serif, 'Courier New', Consolas, monospace",
"workbench.editor.untitled.hint": "hidden",
"editor.fontSize": 18,
"editor.wordWrap": "on",
"json.schemas": [
],
"files.exclude": {
"**/.o": true
},
"editor.mouseWheelZoom": true,
"editor.columnSelection": false,
"editor.lineNumbers": "on",
"editor.find.autoFindInSelection": "always",
"editor.autoClosingBrackets": "always",
"editor.fontLigatures": false,
"cSpell.userWords": [
"abhishek",
"begin",
"FEISTEL",
"get",
"glthread",
"head",
"iterate",
"LSPDB",
"reschd",
"sagar",
"slotlist",
"unconfig",
"wt",
"XCALLOC"
],
"terminal.integrated.scrollback": 10000,
"files.autoSave": "afterDelay",
"terminal.integrated.tabs.location": "left",
"terminal.integrated.fontSize": 16,
"window.zoomLevel": 1,
"terminal.integrated.allowChords": false,
"terminal.integrated.environmentChangesRelaunch": false,
"terminal.integrated.enableMultiLinePasteWarning": false,
"editor.guides.indentation": false,
"editor.tabSize": 4,
}

View File

@@ -134,7 +134,7 @@ void
resurrect_timer(Timer_t *timer){ resurrect_timer(Timer_t *timer){
int rc; int rc;
rc = timer_settime(timer->posix_timer, 0, &timer->ts, NULL); rc = timer_settime(*(timer->posix_timer), 0, &timer->ts, NULL);
assert(rc >= 0); assert(rc >= 0);
} }
@@ -153,6 +153,8 @@ delete_timer(Timer_t *timer){
assert(rc >= 0); assert(rc >= 0);
timer->user_arg = NULL; /* User arg need to be freed by Appln */ timer->user_arg = NULL; /* User arg need to be freed by Appln */
timer_set_state(timer, TIMER_DELETED); timer_set_state(timer, TIMER_DELETED);
free (timer->posix_timer);
free(timer);
} }
void void

View File

@@ -19,7 +19,7 @@ main(int argc, char **argv){
char *name = "Abhishek"; char *name = "Abhishek";
Timer_t *timer = setup_timer(app_cb, 50 , 50, 0, name, true); Timer_t *timer = setup_timer(app_cb, 500 , 500, 0, name, false);
start_timer(timer); start_timer(timer);
printf("1. Pause Timer\n"); printf("1. Pause Timer\n");
@@ -65,9 +65,8 @@ main(int argc, char **argv){
case 8: case 8:
print_timer(timer); print_timer(timer);
break; break;
deafault: ; default: ;
} }
} }
pause();
return 0; return 0;
} }