Click to See Complete Forum and Search --> : CArchive and Multithreading
franck
10-26-2000, 04:06 PM
Hi,
CArchive and CSocketFile don't work in my multithreaded server.
Can someone help?
That kind of stuff is not working:
class A : public WinThread
{
CArchive archiveIn;
CArchive archiveOut;
CSocketFile fsocket;
...}
//later...
A mythread;
AfxBeginThread(&MyThreadProc, a);
// In my threadproc...
MyThreadProc(LPVOID mythread)
{
// the next line buggs...
mythread.myarchiveIn >> myValue;
}
Help me please
Mandar Wadekar
10-30-2000, 10:43 AM
Dear franck,
Static callback function for thread needs a pointer to object. That you have
declared rightly. But are you sending pointer to the object of class A? I
can not see the code to that effect. pardon me if I am wrong.
Regards,
Mandar
>class A : public WinThread
>{
> CArchive archiveIn;
> CArchive archiveOut;
> CSocketFile fsocket;
>...}
>
>//later...
>A mythread;
>AfxBeginThread(&MyThreadProc, a);
>
>// In my threadproc...
>MyThreadProc(LPVOID mythread)
>{
> // the next line buggs...
> mythread.myarchiveIn >> myValue;
>}
>
>Help me please
>
Franck
10-30-2000, 11:44 AM
Hi mandar and thanks for responding,
sorry I made a mistake in my code.
Here is the corrected version...
class A : public WinThread
{
CArchive archiveIn;
CArchive archiveOut;
CSocketFile fsocket;
...}
//later...
A mythread;
AfxBeginThread(&MyThreadProc, &mythread);
// In my threadproc...
MyThreadProc(LPVOID mythread)
{
A * myNEWthread = (A*)mythread;
// the next line KEEPS ON bugging!!
myNEWthread.myarchiveIn >> myValue;
}
Feel free to give me some more advices about this...
Thanks again.
Franck
"Mandar Wadekar" <mkwadekar@usa.net> wrote:
>
>Dear franck,
>
>Static callback function for thread needs a pointer to object. That you
have
>declared rightly. But are you sending pointer to the object of class A?
I
>can not see the code to that effect. pardon me if I am wrong.
>
>Regards,
>
>Mandar
>>class A : public WinThread
>>{
>> CArchive archiveIn;
>> CArchive archiveOut;
>> CSocketFile fsocket;
>>...}
>>
>>//later...
>>A mythread;
>>AfxBeginThread(&MyThreadProc, a);
>>
>>// In my threadproc...
>>MyThreadProc(LPVOID mythread)
>>{
>> // the next line buggs...
>> mythread.myarchiveIn >> myValue;
>>}
>>
>>Help me please
>>
>
devx.com
Copyright Internet.com Inc. All Rights Reserved