b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

mutex 用法_createthread函数用法_releasemutex函数(3)

电脑杂谈  发布时间:2017-01-11 14:19:49  来源:网络整理

}

DWORD WINAPIWriteToDatabase( LPVOID lpParam )

{

DWORDdwCount=0, dwWaitResult;

//Request ownership of mutex.

while(dwCount < 100 )

{

dwWaitResult = WaitForSingleObject(

ghMutex, // handle to mutex

INFINITE); // no time-out interval

switch(dwWaitResult)

{

// Thethread got ownership of the mutex

caseWAIT_OECT_0:

__try{

g_x++;

//TODO: Write to the database

printf('Thread %d writing to database\n',

GetCurrentThreadId());

dwCount++;

}

__finally {

//Release ownership of the mutex object

if (!ReleaseMutex(ghMutex))

{

//Deal with error.

}

}

break;

// Thethread got ownership of an abandoned mutex

caseWAIT_ABANDONED:

returnFALSE;

}

}

returnTRUE;

}


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-25584-3.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 任兴磊
      任兴磊

      用老百姓的民用船只把它围住

    热点图片
    拼命载入中...