Go Back   FlashFXP Forums > >

Programming Need help with C/C++/Delphi? Ask here and make us all laugh.

Closed Thread
 
Thread Tools Rate Thread Display Modes
Old 10-17-2003, 10:51 PM   #1
Mouton
Posse Member
Ultimate Scripter
ioFTPD Administrator
 
Join Date: Dec 2002
Posts: 1,956
Default bad ONLINEDATA usage ?

What's wrong with this code ?
It appears to work correctly, until you try to run multiple threads that does that... Then, it makes io (.14 and probably earlier) crash (probably when 2 threads do that at the exact same time).

I know it's this code that makes it crash cause if i comment the sendmessage, it doesn't crash anymore.

Code:
int iPos = 0, nPos = 0, Users = 0;
while (nPos != -1 && Users < 1000 ) {
	// Initial setup for DC_GET_ONLINEDATA
	lpMessage->dwIdentifier	= DC_GET_ONLINEDATA;
	LPDC_ONLINEDATA pOnlineData = (LPDC_ONLINEDATA)lpMessage->lpContext;
	pOnlineData->iOffset = nPos;
	pOnlineData->dwSharedMemorySize = sizeof(DC_MESSAGE) + sizeof(DC_ONLINEDATA) + (_MAX_PATH + 1) * 2;

	// Send Message
	dwReturn = SendMessage(hIoFTPD, WM_SHMEM, NULL, (LPARAM)hMemory);
	if (!dwReturn) {
		// Wait until processed (5 secs)
		if (WaitForSingleObject(hEvent, 5000) == WAIT_TIMEOUT) break;

		nPos = pOnlineData->iOffset;
		if (iPos>=nPos || nPos == 1024)
			break;

		Users++;
		iPos = nPos;
	}
}
Mouton is offline  
Closed Thread

Tags
crash, dwreturn, ipos, npos, threads


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Site to site question, wont connect Xbox4144 General Discussion 3 01-09-2005 10:38 AM


All times are GMT -5. The time now is 03:34 AM.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)