关于线程的表示ID问题,谢谢赐教!
我在一个进程中创建了3个线程,用函数_beginthreadex(,,,,unsigned* thrdaddr)
问题是:
1.在调试时选择debug->thread,怎么知道线程的ID?
2.得到线程ID用什么函数?怎么用?
3.调试一个多线程的程序,各位有什么经验嘛?
谢谢!
问题点数:0、回复次数:6Top
1 楼huanyun(无妻徒刑)回复于 2003-11-01 21:01:31 得分 0
在线程函数中将需要的状态直接写到文件
Top
2 楼huanyun(无妻徒刑)回复于 2003-11-01 21:03:57 得分 0
_beginthread的返回值就是线程的句柄Top
3 楼byyyyy(苦行僧【苦】)回复于 2003-11-01 21:57:14 得分 0
楼上的你好,返回的是线程的句柄,不是ID.Top
4 楼wangjs720(听雨舟)回复于 2003-11-02 18:48:24 得分 0
The GetProcessId function retrieves the process identifier of the specified process.
void GetProcessId(
HANDLE Process
);
Parameters
Process
[in] Handle to the process. The handle must have the PROCESS_QUERY_INFORMATION access right.
Return Values
If the function succeeds, the return value is the process identifier of the specified process.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Top
5 楼rockrabbit(rockrabbit)回复于 2003-11-20 14:11:11 得分 0
不知道线程句柄,但可以调用一个写日志的函数,能否记下当前线程ID?
Top
6 楼GR(终于重新开始用MFC,捡起来好累)回复于 2003-11-20 15:03:18 得分 0
你_beginthread之后放在最后的参数pdwThreadID就是ID的地址。Top




