开发者

Where can I find Multithreading tutorials? [duplicate]

开发者 https://www.devze.com 2023-03-05 17:22 出处:网络
This question already has answers here: 开发者_运维百科 Closed 11 years ago. Possible Duplicate: C++ multithreading tutorial
This question already has answers here: 开发者_运维百科 Closed 11 years ago.

Possible Duplicate:

C++ multithreading tutorial

I have a project I need to deliver and were supposed to use multi-threading using WIN32 API.

I am a beginner at windows programming and I need a helpful tutorial that can help me with that, any recommendations?

I'm using Visual Studio C++


As simple as it gets.

#include <windows.h>
#include <iostream>

using namespace std;

void my_function(char* parameter){
  cout << parameter;
}

int main(){

char* passpointer = "hahaha";

HANDLE recvhand = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)my_function,passpointer,0,NULL);

Sleep(1000);

}

Basically you can use the CreateThread function just like you see it, for any simple threading. If you need more advanced help, you can ask specific addressable questions, or you can do some advanced google searching =)


Seriously, I think you are in trouble. Multithreaded programming is fairly hard, and it is unreasonable for a novice programmer to expect to get it right.

Is this homework, or are you doing it for an employer (or something else)?

0

精彩评论

暂无评论...
验证码 换一张
取 消