Sunday, July 17, 2011

Mutex Linux version to Windows version

I nowadays working on Synchronization problems in Windows CE. Than I studying and searching in the Internet resources, some software developers solve the problems for Mutex.

The following links have examples and comparing in linux and windows.

http://www.ibm.com/developerworks/linux/library/l-ipc2lin3/index.html

http://suacommunity.com/dictionary/pthread_mutex_lock-entry.php

I little bit analysis above articles. In my case mutex problems linux to windows version.

Linux version:

pthread_mutex_init(&mt_protectClientList, NULL);

Windows version:

mt_protectClientList=CreateMutex(NULL,false,NULL);


Linux version:

pthread_mutex_lock( &(pc_serverData->mt_protectClientList) );

Windows version:

dwWaitResult=WaitForSingleObject(mt_protectClientList,INFINITE);


Linux version:

pthread_mutex_unlock( &(pc_serverData->mt_protectClientList) );

Windows version:

if(dwWaitResult==WAIT_OBJECT_0)

{ ReleaseMutex(mt_protectClientList); }

But, I don't know exactly correct and working well. (Compiling noerror :) )


No comments:

Post a Comment