Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <windows.h>
- #include <iostream>
- DWORD WINAPI ThreadFunc(void* data) {
- // Do stuff. This will be the first function called on the new thread.
- // When this function returns, the thread goes away. See MSDN for more details.
- int j = 0;
- while (j < 1000) {
- printf("(%d) ", j);
- j++;
- }
- return 0;
- }
- int main() {
- int i = 0;
- while (i < 5) {
- printf("C");
- i++;
- }
- HANDLE thread = CreateThread(NULL, 0, ThreadFunc, NULL, 0, NULL);
- if (thread) {
- // Optionally do stuff, such as wait on the thread.
- }
- i = 0;
- while (i < 100) {
- printf("%d ", i);
- i++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement