C++里面,long和int是相同的,64位长整型要用longlong

This commit is contained in:
nnhy 2015-08-06 08:30:35 +00:00
parent fad7d6c776
commit ac31c30469
5 changed files with 8 additions and 7 deletions

View File

@ -552,7 +552,7 @@ void TSys::ToHex(byte* buf, byte* src, uint len)
#include "Task.h"
// 创建任务返回任务编号。priority优先级dueTime首次调度时间usperiod调度间隔us-1表示仅处理一次
uint TSys::AddTask(Action func, void* param, long dueTime, long period, string name)
uint TSys::AddTask(Action func, void* param, Int64 dueTime, Int64 period, string name)
{
return Scheduler.Add(func, param, dueTime, period, name);
}

2
Sys.h
View File

@ -130,7 +130,7 @@ private:
public:
// 创建任务返回任务编号。dueTime首次调度时间usperiod调度间隔us-1表示仅处理一次
uint AddTask(Action func, void* param, long dueTime = 0, long period = 0, string name = NULL);
uint AddTask(Action func, void* param, Int64 dueTime = 0, Int64 period = 0, string name = NULL);
void RemoveTask(uint taskid);
// 设置任务的开关状态同时运行指定任务最近一次调度的时间0表示马上调度
bool SetTask(uint taskid, bool enable, int usNextTime = -1);

View File

@ -110,7 +110,7 @@ TaskScheduler::~TaskScheduler()
}
// 创建任务返回任务编号。dueTime首次调度时间us-1表示事件型任务period调度间隔us-1表示仅处理一次
uint TaskScheduler::Add(Action func, void* param, long dueTime, long period, string name)
uint TaskScheduler::Add(Action func, void* param, Int64 dueTime, Int64 period, string name)
{
Task* task = new Task(this);
task->ID = _gid++;

8
Task.h
View File

@ -26,8 +26,8 @@ public:
Action Callback; // 回调
void* Param; // 参数
long Period; // 周期us
long NextTime; // 下一次执行时间
Int64 Period; // 周期us
Int64 NextTime; // 下一次执行时间
int Times; // 执行次数
int CpuTime; // 总耗费时间
@ -38,7 +38,7 @@ public:
bool Enable; // 是否启用
byte Deepth; // 当前深度
byte MaxDeepth; // 最大深度。默认1层不允许重入
byte Reversed[3];// 保留,避免对齐问题
byte Reversed[1];// 保留,避免对齐问题
~Task();
@ -71,7 +71,7 @@ public:
~TaskScheduler();
// 创建任务返回任务编号。dueTime首次调度时间us-1表示事件型任务period调度间隔us-1表示仅处理一次
uint Add(Action func, void* param, long dueTime = 0, long period = 0, string name = NULL);
uint Add(Action func, void* param, Int64 dueTime = 0, Int64 period = 0, string name = NULL);
void Remove(uint taskid);
void Start();

1
Type.h
View File

@ -30,6 +30,7 @@ typedef long long Int64;
typedef unsigned long long UInt64;
typedef char* String;
*/
typedef long long Int64;
#include <typeinfo>
using namespace ::std;