Quote:
Would the above code create two threads each with same functionality(since thread procedure for both of the threads is same.)
Yes.
Quote:
Am I doing it correctly?
Basically yes. However you shouldn't pass address of
i
if it is a local variable (and probably you just need its value).
Change
(LPVOID) &i
to
(LPVOID) i
Moreover, I wouldn't overwrite
dwThreadId
value, use two variables like you did for the thread handles.
Quote:
If it is possible then would there be any synchronization issues since both threads are using same Thread Procedure.
Of course there are synchronization issues, however they do not depend on thread sharing the same function (each thread have its own copy of local variables). They depend on both threads being allowed to access global variables. So there are synchronization issues between the two threads and between each of them and the main one.