我用Sleep做主程序中等,在Sleep前面我开了一个线程。为什么在Sleep的过程中,线程也不干活了??为什么?如果让线程干活,主程序等,用什么方法实现?
解决方案 »
- HINSTANCE和HMODULE这两种类型的句柄,用法不同么?
- 如何解决ReadDirectoryChangesW重复响应同一份文件修改
- 关于 vc6 资源框
- 各位神仙,怎样能够保存设置,使程序下次运行的时候能够记忆上次的设置呢?
- 滚动视图的问题,如何只滚动视图中的一部分?
- vc中如何显示jpg
- tcp协议 send返回值正确 接收端数据错误
- 关于RemoteDataCtl和DBGrid控件的一个问题
- 请问在哪里可以下载 VisualAge for Java?
- 请问哪个函数如何将CDateTimeCtrl设成不可编辑得模式
- 请问哪儿有CD_Rom 的UDF文件格式的中文说明
- 求助:关于辅助线程、MFC静态库
HANDLE hHandle,
DWORD dwMilliseconds
);Parameters
hHandle
[in] Handle to the object. For a list of the object types whose handles can be specified, see the following Res section.
If this handle is closed while the wait is still pending, the function's behavior is undefined.The handle must have the SYNCHRONIZE access right. For more information, see Standard Access Rights.dwMilliseconds
[in] Time-out interval, in milliseconds. The function returns if the interval elapses, even if the object's state is nonsignaled. If dwMilliseconds is zero, the function tests the object's state and returns immediately. If dwMilliseconds is INFINITE, the function's time-out interval never elapses.
Return Values
If the function succeeds, the return value indicates the event that caused the function to return. It can be one of the following values.Return Code Description:WAIT_ABANDONED The specified object is a mutex object that was not released by the thread that owned the mutex object before the owning thread terminated. Ownership of the mutex object is granted to the calling thread, and the mutex is set to nonsignaled. WAIT_OBJECT_0 The state of the specified object is signaled. WAIT_TIMEOUT The time-out interval elapsed, and the object's state is nonsignaled.
可能就是你的工作线程创建后是挂起状态的,一般设置一个全局的同步变量, 主线程再另外开启一个线程,去检测这个同步变量的值变化以确定工作线程是否完成