CriticalSection-NT & Mutex-Linux

CriticalSection-NT & Mutex-Linux

Post by Venka » Fri, 20 Jun 2003 18:06:43



Hi All,

If my understanding is right the equivalent data type of CriticalSection of
Win32 API
in Linux(all other flavors of unix/POSIX standard) is pthread_mutex_t.

In Windows we have 4 methods for critical section like
InitializeCriticalSection
EnterCriticalSection
LeaveCriticalSection
DeleteCriticalSection

and the equivalent in Linux(POSIX) are
pthread_mutex_init
pthread_mutex_lock
pthread_mutex_unlock

but i want to know what is the equivalent of DeleteCriticalSection in Linux?

Regards
Venkat

 
 
 

CriticalSection-NT & Mutex-Linux

Post by David Schwart » Fri, 20 Jun 2003 18:19:47



Quote:> Hi All,

> If my understanding is right the equivalent data type of CriticalSection
of
> Win32 API
> in Linux(all other flavors of unix/POSIX standard) is pthread_mutex_t.

> In Windows we have 4 methods for critical section like
> InitializeCriticalSection
> EnterCriticalSection
> LeaveCriticalSection
> DeleteCriticalSection

> and the equivalent in Linux(POSIX) are
> pthread_mutex_init
> pthread_mutex_lock
> pthread_mutex_unlock

> but i want to know what is the equivalent of DeleteCriticalSection in

Linux?

    pthread_mutex_destroy.

    DS

 
 
 

CriticalSection-NT & Mutex-Linux

Post by Timur Aydi » Sat, 21 Jun 2003 07:15:39



> Hi All,

> If my understanding is right the equivalent data type of CriticalSection of
> Win32 API
> in Linux(all other flavors of unix/POSIX standard) is pthread_mutex_t.

There is one important difference between these two:

The win32 critical sections can be recursively locked by the same
thread, while the pthread_mutex_t cannot. An application relying on
the recursive nature of Critical Sections will deadlock under Linux.

--
Timur Aydin

 
 
 

CriticalSection-NT & Mutex-Linux

Post by Kevin Easto » Sat, 21 Jun 2003 08:27:00




>> Hi All,

>> If my understanding is right the equivalent data type of CriticalSection of
>> Win32 API
>> in Linux(all other flavors of unix/POSIX standard) is pthread_mutex_t.

> There is one important difference between these two:

> The win32 critical sections can be recursively locked by the same
> thread, while the pthread_mutex_t cannot. An application relying on
> the recursive nature of Critical Sections will deadlock under Linux.

You can specify a recursive mutex at creation time, if that's what you
need.

        - Kevin.

 
 
 

CriticalSection-NT & Mutex-Linux

Post by Timur Aydi » Sat, 21 Jun 2003 16:33:00



> You can specify a recursive mutex at creation time, if that's what you
> need.

Last time I checked, this was a non-portable extension of glibc and
not startardized by POSIX. Has this changed?

--
Timur Aydin

 
 
 

CriticalSection-NT & Mutex-Linux

Post by Thomas Borg Salli » Thu, 26 Jun 2003 23:14:19



> Last time I checked, this was a non-portable extension of glibc and
> not startardized by POSIX. Has this changed?

IEEE POSIX 1003.1c -- draft 10 is the final and approved version.

There's lots of discussions about this on comp.programming.threads.

Best regards,
Thomas.
-linux/g++/ACE/TAO/Qt-developer for hire!

 
 
 

1. NT NT NT NT NT NT NT MT

Why is everyone comparing whatever operating system with NT?

**************************************************************************
*     / - -                           /-----/ /                          *
*    /____  /   / /----/ /----/      /       /     /----/ /---/ /----/   *
*        / / / / /----/ /----/      /       /---/ /----/ /   / /----/    *
*   ___ / /_/_/ /____  /____       /_____/ /   / /____  /   /  ____/     *

**************************************************************************
---
 t MR/2 t

2. Newbie Telnet woes

3. Linux & Netware & NT & Pathworks

4. bumpin off undesired connecitons

5. Please Be Gentle: Anyone install Linux, NT Workstation, & NT Server on one box?

6. XF86Config-4 help for Dell C800

7. Dual booting DOS/NT & Installing Linux on PC running NT,

8. Problems with SendMail on Open Server 5.0.2

9. multi-booting Linux & '95 & NT - advice sought

10. Window NT 4 & Red Hat Linux 5.2 & Boot Magic

11. linux-alpha & NT 40 SP3 & Win95

12. Linux firewall & load-balancing NAT & NT-IIS

13. Samba & Linux RH52 --- NT & Access