[7810] Moved ZThread related code on ACE framework.

Remove ZThread source code from mangos.
Signed-off-by: AlexDereka <dereka.alex@gmail.com>
This commit is contained in:
Ambal 2009-05-11 12:13:41 +04:00 committed by AlexDereka
parent f117ce3420
commit 2aff48cc5d
182 changed files with 684 additions and 21041 deletions

View file

@ -171,7 +171,7 @@ typedef struct AuthHandler
#endif
/// Launch a thread to transfer a patch to the client
class PatcherRunnable: public ZThread::Runnable
class PatcherRunnable: public ACE_Based::Runnable
{
public:
PatcherRunnable(class AuthSocket *);
@ -234,7 +234,8 @@ AuthSocket::AuthSocket(ISocketHandler &h) : TcpSocket(h)
/// Close patch file descriptor before leaving
AuthSocket::~AuthSocket()
{
ZThread::Guard<ZThread::Mutex> g(patcherLock);
ACE_Guard<ACE_Thread_Mutex> g(patcherLock);
if(pPatch)
fclose(pPatch);
}
@ -910,7 +911,7 @@ bool AuthSocket::_HandleXferResume()
ibuf.Read((char*)&start,sizeof(start));
fseek(pPatch,start,0);
ZThread::Thread u(new PatcherRunnable(this));
ACE_Based::Thread u(*new PatcherRunnable(this));
return true;
}
@ -922,7 +923,6 @@ bool AuthSocket::_HandleXferCancel()
///- Close and delete the socket
ibuf.Remove(1); //clear input buffer
//ZThread::Thread::sleep(15);
SetCloseAndDelete();
return true;
@ -944,8 +944,7 @@ bool AuthSocket::_HandleXferAccept()
ibuf.Remove(1); //clear input buffer
fseek(pPatch,0,0);
ZThread::Thread u(new PatcherRunnable(this));
ACE_Based::Thread u(*new PatcherRunnable(this));
return true;
}
@ -963,7 +962,8 @@ PatcherRunnable::PatcherRunnable(class AuthSocket * as)
/// Send content of patch file to the client
void PatcherRunnable::run()
{
ZThread::Guard<ZThread::Mutex> g(mySocket->patcherLock);
ACE_Guard<ACE_Thread_Mutex> g(mySocket->patcherLock);
XFER_DATA_STRUCT xfdata;
xfdata.opcode = XFER_DATA;
@ -972,7 +972,7 @@ void PatcherRunnable::run()
///- Wait until output buffer is reasonably empty
while(mySocket->Ready() && mySocket->IsLag())
{
ZThread::Thread::sleep(1);
ACE_Based::Thread::Sleep(1);
}
///- And send content of the patch file to the client
xfdata.data_size=fread(&xfdata.data,1,ChunkSize,mySocket->pPatch);