SetProcessorAffinity 给我带来了问题
好吧,我正在尝试部署我的第一个使用多线程的 Xbox 360 XNA 游戏,并且我正在尝试使用 Thread.CurrentThread.SetProcessorAffinity() 函数将一个线程放在另一个硬件线程上,例如所以:
#if XBOX360
Thread.CurrentThread.SetProcessorAffinity(new int[] { xbox360UpdateThread });
Thread.CurrentThread.IsBackground = true;
#endif
我也尝试过这个:
#if XBOX
Thread.CurrentThread.SetProcessorAffinity(new int[] { xbox360UpdateThread });
Thread.CurrentThread.IsBackground = true;
#endif
编译器给我上面第一条指令中的括号带来的问题..在VS2008中,所有括号都用红色标记加下划线,我得到以下错误:
error CS1519: Invalid token '(' in class, struct, or interface member declaration
error CS1519: Invalid token '{' in class, struct, or interface member declaration
error CS1519: Invalid token '}' in class, struct, or interface member declaration
error CS0116: A namespace does not directly contain members such as fields or methods
如果我隐藏整个线程上面的指令,我在 Xbox 360 上编译并运行我的游戏..只有这个线程指令导致了问题..
有人知道我做错了什么吗?我使用的是 XNA 3.1,而不是 4.0 ..
Well I'm trying to deploy my first ever Xbox 360 XNA game which uses multithreading, and I'm trying to put a thread on another hardware thread using the Thread.CurrentThread.SetProcessorAffinity()
function, like so:
#if XBOX360
Thread.CurrentThread.SetProcessorAffinity(new int[] { xbox360UpdateThread });
Thread.CurrentThread.IsBackground = true;
#endif
I have also tried this:
#if XBOX
Thread.CurrentThread.SetProcessorAffinity(new int[] { xbox360UpdateThread });
Thread.CurrentThread.IsBackground = true;
#endif
The compiler is giving me problem with the brackets somewhere in the first instruction above .. In VS2008, all the brackets are underlined with those red markers and I get the following errors:
error CS1519: Invalid token '(' in class, struct, or interface member declaration
error CS1519: Invalid token '{' in class, struct, or interface member declaration
error CS1519: Invalid token '}' in class, struct, or interface member declaration
error CS0116: A namespace does not directly contain members such as fields or methods
if I hide the entire threading directive above, and I compile and run my game on the Xbox 360 .. Only this threading directive is causing a problem ..
Anyone know what am I doing wrong ? I'm using XNA 3.1, not 4.0 ..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会做以下事情:
I would do the following: