スキップしてメイン コンテンツに移動

投稿

5月, 2009の投稿を表示しています

C++.NetでのThreadの実行方法

C++.NetでのThreadの実行方法です。C#でThreadの使い方を知っていれば、理解はしやすいと思います。 using namespace System; using namespace System::Threading; ref class Work { public: static void DoWork() { Console::WriteLine( "Static thread procedure." ); } void DoMoreWork() { Console::WriteLine( "Instance thread procedure."); } }; int main(array ^args) { Work ^w = gcnew Work; ThreadStart ^start = gcnew ThreadStart(w, &Work::DoMoreWork); Thread ^t = gcnew Thread(start); t->Start(); Console::ReadLine(); return 0; }