]> pd.if.org Git - pdclib/blob - platform/win32/functions/threads/mtx_unlock.c
PDCLib includes with quotes, not <>.
[pdclib] / platform / win32 / functions / threads / mtx_unlock.c
1 #ifndef REGTEST\r
2 #include <threads.h>\r
3 #include <windows.h>\r
4 \r
5 extern void _PDCLIB_w32errno( void );\r
6 int mtx_unlock(mtx_t *mtx)\r
7 {\r
8     if(mtx->_NestCount) {\r
9         mtx->_NestCount--;\r
10         return thrd_success;\r
11     }\r
12 \r
13     mtx->_ThreadId = 0;\r
14     DWORD rv = SetEvent(mtx->_WaitEvHandle);\r
15     if(rv == 0) {\r
16         _PDCLIB_w32errno();\r
17         return thrd_error;\r
18     }\r
19     return thrd_success;\r
20 }\r
21 #endif\r
22 \r
23 #ifdef TEST\r
24 #include "_PDCLIB_test.h"\r
25 \r
26 int main( void )\r
27 {\r
28     return TEST_RESULTS;\r
29 }\r
30 \r
31 #endif