Created
October 17, 2022 19:37
-
-
Save adililhan/bc003cbf02e8750c6b14f17ecf6d3cd1 to your computer and use it in GitHub Desktop.
non-reentrant function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
int sum; | |
int calculate(int first, int second) { | |
sum = first + second; | |
sleep(3); // represent I/O intensive function call | |
return sum; | |
} | |
int main() | |
{ | |
for (;;) { | |
printf("Result from main: %d\n", calculate(3, 5)); | |
printf("---\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment