A
ansili
Unregistered / Unconfirmed
GUEST, unregistred user!
多个全局变量要在线程里使用,需要定义几个临界区(TCriticalSection)还是一个?我现在每个全局都定义了一个。请高手指教/
代码:
extern TList *OnlineUserList;
extern TList *PlayWindowList;
extern TCriticalSection *ProtectSectionOnlineUserList;
extern TCriticalSection *ProtectSectionPlayWindowList;
extern TQueue *UserDownQueue;
//需要下载的用户队列
extern TQueue *DownFileQueue;
//FTP下载队列
extern TQueue *DecodeQueue;
//解码队列
extern TQueue *PlayQueue;
//播放显示队列
extern TCriticalSection *ProtectSectionUserDown;
//临界区
extern TCriticalSection *ProtectSectionDownFile;
//临界区
extern TCriticalSection *ProtectSectionDecode;
//临界区
extern TCriticalSection *ProtectSectionPlay;
//临界
代码:
extern TList *OnlineUserList;
extern TList *PlayWindowList;
extern TCriticalSection *ProtectSectionOnlineUserList;
extern TCriticalSection *ProtectSectionPlayWindowList;
extern TQueue *UserDownQueue;
//需要下载的用户队列
extern TQueue *DownFileQueue;
//FTP下载队列
extern TQueue *DecodeQueue;
//解码队列
extern TQueue *PlayQueue;
//播放显示队列
extern TCriticalSection *ProtectSectionUserDown;
//临界区
extern TCriticalSection *ProtectSectionDownFile;
//临界区
extern TCriticalSection *ProtectSectionDecode;
//临界区
extern TCriticalSection *ProtectSectionPlay;
//临界