stans
December 30th, 2004, 09:52 PM
Now i am using C++ try to create a Thread class, and used by main function.
in the main function i will create 2 threads and 1 critical section and 1 com port handle, i want the 2 threads share the same handle and critical section.
in the construction of thread, i pass the address of handle and critical section in.
In the function of thread i will try to enter the critical section and do something.
But now the condition i met is that neither of the 2 threads can enter the critical section.
If i don't care about the critical section, neither of them can use the send thing to com port handle.
So is there anyone met this condition before? what's the problem?
Thanks a lot for your help in advance...
in the main function i will create 2 threads and 1 critical section and 1 com port handle, i want the 2 threads share the same handle and critical section.
in the construction of thread, i pass the address of handle and critical section in.
In the function of thread i will try to enter the critical section and do something.
But now the condition i met is that neither of the 2 threads can enter the critical section.
If i don't care about the critical section, neither of them can use the send thing to com port handle.
So is there anyone met this condition before? what's the problem?
Thanks a lot for your help in advance...