heres what I have so far (I know that I dont really need the 'Simple' class, but i'll worry about that later)...
#include <stdio.h>
#include <iostream>
#include <time.h>
#include <ctime>
#include <Windows.h>
using namespace std;
using namespace System;
using namespace System::Threading;
int SecondCount = 0;
public ref class ServerClass
{
public:
// The method that will be called when the thread is started.
void InstanceMethod()
{
while (1)
{
Thread::Sleep(1000);
SecondCount++;
Console::WriteLine(SecondCount);
if(SecondCount == 10)
{
cout<<endl;
SecondCount = 0;
}
}
}
};
public ref class Simple
{
public:
static void Main()
{
Console::WriteLine("Thread Simple Sample");
ServerClass^ serverObject = gcnew ServerClass();
Thread^ InstanceCaller = gcnew Thread(gcnew ThreadStart(serverObject, &ServerClass::InstanceMethod));
// Start the thread.
InstanceCaller->Start();
}
};
int main(int argc, char *argv[])
{
Simple::Main();
if(SecondCount == 10)
{
exit(1);
}
return 0;
}

New Topic/Question
Reply


MultiQuote





|