[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[JDEV] RE: G'morn! :)



	DESPERATLY trying to finish it.. ;-P  I only need to fix ONE problem and it'll be ready.  Incoming xpt packets are now processed in
their own thread (UBER cool..  When there are xpt packets to process, it starts a new thread, which in turn starts a new Message
'object' that works within an independant thread).  The only problem is starting a new thread when a user wants to send a NEW
message.  For some reason that I have yet to fathom, it produces an Access Violation.  Here is what the function call that dies
looks like:

---
	DWORD * dwThreadId;
	int * Something;


ateThread( 
            NULL,              // no security attribute 
            0,                 // default stack size 
            (LPTHREAD_START_ROUTINE) InstanceNewMessageThread,
            (LPVOID) Something,    // thread parameter 
            0,                 // not suspended 
            dwThreadId);      // returns thread ID

---
	InstantNewMessageThread looks like this:

---
VOID InstanceNewMessageThread(LPVOID lpvParam) 
{ 
	AfxMessageBox("In New Message Thread");
	CNewMessage dlg;
	int nReturn = dlg.DoModal();
	if(nReturn == IDOK)
	{
		ServerSocket.SendData("<message><to>" +
			dlg.m_To + "</to><subject>" +
			dlg.m_Subject + "</subject><say>" +
			dlg.m_Say + "</say></message>\n\n");
	}

} 
---

	What dying is when it creates the new thread, which means that the error itself is in the first code snippet.  Any ideas?  I think that perhaps I'm not initiating the Pointer that is the 'passed argument' correctly.  Perhaps I'm just being an idiot.  Any idea how to create a Pointer to a void value in C?  I think I need to malloc somethingand get the pointer to point to that.  I'm not USING the value, so I was trying to throw it SOMETHING.. ;-P

	Obviously it's only sending basic to/subject/say messages right now, but this is easily extended.  Eventually, I'll have the JabberSocket class (An extention of CAsyncSocket) have message sending members of it's own, but for now I just have it using a generic 'SendData' function, that piles up data sends it as it can.  The class itself handles blocking etc, itself, as CAsyncSocket provides callbacks when it's ok to send or ok to recieve when you try to send.. 

	Anyway, I'mnot to sure how well you know C++, but my problem here is basic C, and I think I'm just thinking way to hard.  Think I'll risk looking like a COMPLETE MORON and CC this to JDev and see if anyone cares to smack some sense into my skull.


> -----Original Message-----
> From: Jeremie 
> Sent: Wednesday, May 12, 1999 9:51 AM
> To: tcharron@nermail.ups.com
> Cc: tcharron@my-dejanews.com
> Subject: G'morn! :)
> 
> 
> Heya, hows the job thing coming along?
> 
> It's been a bit quite lately on jdev, but I've got lots of fun things
> coming RSN besides just 0.6.  I'll be posting a big plan/outlook tonight
> hopefully...
> 
> Other than that, the ICQ and AIM transports are developing nicely, very
> very "prototype" like, but still very cool.
> 
> Any luck with the win32 stuff?  I wish I had a compiler or knew win32 to
> at least offer to help a little :)  I'll be creating "teams" on jabber.org
> and I think there will be a win32 one, do you think you'll have the time
> to lead it?  It wont be till late May or early June for sure.
> 
> Anyway, just checking in!
> 
> Thanks!
> 
> Jer
> 
>