2024年6月13日发(作者:)
81
82 // Release the semaphore when task is finished
83
84 if (!ReleaseSemaphore(
85 ghSemaphore, // handle to semaphore - hSemaphore是要增加的信号量句柄
86 1, // increase count by one - lReleaseCount是增加的计数
87 NULL) ) // not interested in previous count - lpPreviousCount是增加前的数值返回
88 {
89 printf("ReleaseSemaphore error: %dn", GetLastError());
90 }
91 break;
92
93 // The semaphore was nonsignaled, so a time-out occurred.
94 case WAIT_TIMEOUT:
95 printf("Thread %d: wait timed outn", GetCurrentThreadId());
96 break;
97 }
98 }
99 return TRUE;
100 }
发布评论