AppFabric RTM 1.1与Windows XP不兼容,你能解决吗? [英] AppFabric RTM 1.1 not compatible with Windows XP, Could you fix ?

查看:93
本文介绍了AppFabric RTM 1.1与Windows XP不兼容,你能解决吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在app fabric缓存客户端的新类中:


 


本机方法:NativeMethods GetCurrentProcessorNumber ();

b

 


你能否使用环境中的先前processorCount来解决这个问题,而不是每次调用这个信息!




对于RTM而言,这是一种紧迫的行为。谢谢。


 


使用  ;系统;

命名空间  Microsoft ApplicationServer 缓存

{

     内部  < span style ="color:#ff0000"> class   OptimizedSafeCounter

     {

         private   OptimizedThreadSafeCounter < span style ="color:#006400"> []   counter ;

      ;     private   int   maximumValue ;

        ;   public   OptimizedSafeCounter int   maximumValue

         {

             Random random =  new   随机 ();

              maximumValue = maximumValue ;

             int   num = random 下一步 ()    maximumValue ;

             int   processorCount = Environment ProcessorCount ;

             int   num2 = maximumValue  /   processorCount ;

             this 计数器=  new   OptimizedThreadSafeCounter [ processorCount ];

             for   int   i =  0 ;   i  <   计数器长度;   i ++)

             {

                 计数器 [ i ]   =  new   OptimizedThreadSafeCounter num    maximumValue < span style ="color:#006400">);

                  num  + = num2 ;

             }

          }

          public   int   下一步 ()

        ;  {

             ; int   currentProcessorNumber = NativeMethods GetCurrentProcessorNumber ();

              return   计数器 [ currentProcessorNumber ]。 下一步 ()    < span style ="font-weight:bold">此 maximumValue ;

         }

   ;   }

}

解决方案

嗨Jeremy,



GetCurrentProcessorNumber函数支持的最小客户端是Windows Vista,它不是在XP中可用。

这是一个与Windows XP一起使用的C ++函数,你可以将它构建到一个库中并在C#.NET中调用它:

http://www.scss.tcd.ie/Jeremy.Jones/GetCurrentProcessorNumberXP.htm

------------------------------------------- ------
$
此响应包含对第三方万维网站点的链接引用。微软提供此信息是为了方便您。

Microsoft不控制这些网站,也没有测试在这些网站上找到的任何软件或信息;因此,Microsoft不能就任何软件或信息的质量,安全性或适用性做出任何陈述在那里找到。

.GetCurrentProcessorNumber();

doesn't exist in windows xp kernel32.

 

Could you fix this with using the previous processorCount from environment, et not getting to each call this information !


It's kind of urgent ... for a RTM. Thank You.

 

using System;
namespace Microsoft.ApplicationServer.Caching
{
    internal class OptimizedSafeCounter
    {
        private OptimizedThreadSafeCounter[] counters;
        private int maximumValue;
        public OptimizedSafeCounter(int maximumValue)
        {
            Random random = new Random();
            this.maximumValue = maximumValue;
            int num = random.Next() % maximumValue;
            int processorCount = Environment.ProcessorCount;
            int num2 = maximumValue / processorCount;
            this.counters = new OptimizedThreadSafeCounter[processorCount];
            for (int i = 0; i < this.counters.Length; i++)
            {
                this.counters[i] = new OptimizedThreadSafeCounter(num % maximumValue);
                num += num2;
            }
        }
        public int Next()
        {
            int currentProcessorNumber = NativeMethods.GetCurrentProcessorNumber();
            return this.counters[currentProcessorNumber].Next() % this.maximumValue;
        }
    }
}

解决方案

Hi Jeremy,

The minimum supported client of the GetCurrentProcessorNumber function is Windows Vista, it is not available in XP.
Here is a C++ function which works with Windows XP, you can build it into a library and P/Invoke it in C#.NET:
http://www.scss.tcd.ie/Jeremy.Jones/GetCurrentProcessorNumberXP.htm.
-------------------------------------------------
This response contains links reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.
Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


Have a nice day,


这篇关于AppFabric RTM 1.1与Windows XP不兼容,你能解决吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆