multithreading - 基于Windows Phone 8的线程

标签 multithreading windows-phone-8

我有一些适用于 iOS 和 Android 的应用程序。我需要将其移植到 Windows Phone 8 上。我们有一些抽象线程子系统,以及使用来自该子系统的线程的内核。所有这些都是 C++ 代码。

我遇到的第一个问题是在 WP8 上运行线程(又名 CreateThread)。 ThreadPool 对我来说不是一个解决方案,因为应用程序使用基于线程的并行性,而不是基于任务的并行性。

我的问题是如何在 WP8 上启动线程?我使用 .NET Thread 类,但它无法编译。可能是做错了什么。请帮我解决这个问题。

最佳答案

您应该能够在 Windows Phone 应用程序中使用线程,使用 System.Threading.Thread类(class)。创建线程很简单,将要执行的方法传递给线程的构造函数,然后启动它:

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

private void DoSomething()
{
    // Do stuff
}

关于multithreading - 基于Windows Phone 8的线程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17357972/

相关文章:

java - Swing JTextArea 多线程问题 - InterruptedException

ios - 如何在后台渲染 CALayer

windows-phone-7 - windows phone游戏(480x800)支持其他分辨率

Java : What happens if a Runnable that is being used in a thread is set to null?

c++ - 在 C++ 多线程程序中使用指向局部变量的指针

python - 停止运行无限循环的 python 线程

gridview - 在 Windows Phone 8 中以 GridView 显示图像

c# - 将 Stream 转换为 byte[] 数组在 Windows Phone 8 C# 中始终返回 0 长度

c - WP8 C++ 运行时组件 : Debug vs Release

c# - 设置超时时 HttpClient 挂起 (Windows Phone)