ExMix
ExMix

Reputation: 46

Thread-based on Windows Phone 8

I have some application for iOS and android. And I need port it on Windows Phone 8. We have some abstract thread subsystem, and kernel using threads from this subsystem. All this is C++ code.

The first problem I encountered, that run thread on WP8 aka CreateThread. ThreadPool is not a solution for me because application use thread-based parallelism, not a task-based.

My question is how to start thread on WP8? I thied use .NET Thread class, but it doesn't compiling. May be a do something wrong. Please help me by this.

Upvotes: 2

Views: 5631

Answers (2)

Sandeep Chauhan
Sandeep Chauhan

Reputation: 1313

you can initialise thread with a method and then start it like

var asd = new System.Threading.Thread(method);
asd.Start();

void method()
{
  // Put your Logic Here .....
}

Upvotes: 0

Kevin Gosse
Kevin Gosse

Reputation: 39007

You should be able to use threads in your Windows Phone application, using the System.Threading.Thread class. Creating a thread is straightforward, pass the method you want to execute to the constructor of the thread, then start it:

public void StartThread()
{
    var thread = new System.Threading.Thread(DoSomething);
    thread.Start();
}

private void DoSomething()
{
    // Do stuff
}

Upvotes: 4

Related Questions