Re: [VB6] - Module for working with multithreading.
lowe517, you can't call the methods of an object between threads without marshaling. You can pass the socket handle between threads so you can create an auxiliary object which lives in the thread. See the example.
Re: [VB6] - Module for working with multithreading.
Originally Posted by The trick
lowe517, you can't call the methods of an object between threads without marshaling. You can pass the socket handle between threads so you can create an auxiliary object which lives in the thread. See the example.
Re: [VB6] - Module for working with multithreading.
Dear The trick,
I find that I can do the some work using VBCreatethread, as well as using a private object as your example showed,all I need to do is that I dim an object(cTCPClient) in the threadFunc and after its method calling I free it. the object exists only in the threadfunc, everything seems all right, but is there anything potentially wrong ?
Re: [VB6] - Module for working with multithreading.
Originally Posted by lowe517
Dear The trick,
I find that I can do the some work using VBCreatethread, as well as using a private object as your example showed,all I need to do is that I dim an object(cTCPClient) in the threadFunc and after its method calling I free it. the object exists only in the threadfunc, everything seems all right, but is there anything potentially wrong ?
The main restriction you shouldn't pass an object reference between threads. The other point is you should track the data and synchronize access. The rules are the same if you would work in C/C++.