中国开发网: 论坛: 程序员情感CBD: 贴子 26335
没脾气2x: 为什么每次更新程序,论坛的恢复都需要好长时间?这么写是不是有问题:
using System;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.SessionState;
using System.Threading;

namespace NoxForum.Web
{
/// <summary>
/// Summary description for Global.
/// </summary>

public class Global : System.Web.HttpApplication
{
public static void ThreadProc()
{
while (true)
{

try
{
string sql;

sql = " DELETE FROM account_onlines WHERE GETDATE() - @DoubleDate > ping_lasttime ";

NoxForum.Framework.Data.SqlDbProvider.ExecuteNonQuery(
sql,
Nox.Common.Data.SqlHelper.MakeInParam("@DoubleDate", (double)1 / 24 / 60 * 10)
);
}
catch
{
// 不处理
}

Thread.Sleep(30000);
}
}


public static Global CurrentApplication;


private Thread m_ThreadMain;

public Global()
{
CurrentApplication = this;

m_ThreadMain = new Thread(new ThreadStart(ThreadProc));
}
protected void Application_Start(Object sender, EventArgs e)
{
System.Configuration.ConfigurationSettings.GetConfig("NoxForumConfiguration");

m_ThreadMain.Start();
}

protected void Application_BeginRequest(Object sender, EventArgs e)
{

}

protected void Application_EndRequest(Object sender, EventArgs e)
{

}

protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{

}

protected void Application_Error(Object sender, EventArgs e)
{

}

protected void Session_Start(Object sender, EventArgs e)
{
}

protected void Session_End(Object sender, EventArgs e)
{

}

protected void Application_End(Object sender, EventArgs e)
{
m_ThreadMain.Suspend();
}

}
}
Notemper2x 3.1 ( ̄ε( ̄#)
没脾气2x 之 个人综合篇: http://notemper2x.cndev.org/
我的 panoramio 相册: http://panoramio.com/user/zhaixudong
我的 flickr相册: http://www.flickr.com/photos/notemper2x/



QQ号20250出售,售价400,000元整(5位、皇冠80级、VIP7)

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录