Changeset 25168 in vbox for trunk/include/iprt
- Timestamp:
- Dec 3, 2009 2:59:20 PM (15 years ago)
- Location:
- trunk/include/iprt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/critsect.h
r25167 r25168 4 4 5 5 /* 6 * Copyright (C) 2006-200 7Sun Microsystems, Inc.6 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 42 42 /** @defgroup grp_rt_critsect RTCritSect - Critical Sections 43 43 * 44 * A "critical section" synchronization primitive. This can be used to 45 * protect a section of code or data to which access must be exclusive. 46 * Only one thread can hold access to a critical section at one time. 47 * 48 * A critical section is a fast write lock; if the critical section is 49 * not acquired, then entering it is fast (requires no system call). 44 * "Critical section" synchronization primitives can be used to 45 * protect a section of code or data to which access must be exclusive; 46 * only one thread can hold access to a critical section at one time. 47 * 48 * A critical section is a fast recursive write lock; if the critical 49 * section is not acquired, then entering it is fast (requires no system 50 * call). IPRT uses the Windows terminology here; on other platform, this 51 * might be called a "futex" or a "fast mutex". As opposed to IPRT 52 * "fast mutexes" (see @ref grp_rt_sems_fast_mutex ), critical sections 53 * are recursive. 50 54 * 51 55 * Use RTCritSectInit to initialize a critical section; use RTCritSectEnter 52 * and RTCritSectLeave to acquire and release access. IPRT uses the Windows 53 * terminology here; on other platform, this might be called a "futex" or a 54 * "fast mutex". 55 * 56 * If you need a read/write semaphore which allows multiple readers 57 * but only writer, use RTSEMRW instead. 56 * and RTCritSectLeave to acquire and release access. 57 * 58 * For an overview of all types of synchronization primitives provided 59 * by IPRT (event, mutex/fast mutex/read-write mutex semaphores), see 60 * @ref grp_rt_sems . 58 61 * 59 62 * @ingroup grp_rt -
trunk/include/iprt/semaphore.h
r21513 r25168 38 38 39 39 /** @defgroup grp_rt_sems RTSem - Semaphores 40 * 41 * This module implements all kinds of event and mutex semaphores; in addition 42 * to these, IPRT implements "critical sections", which are fast recursive 43 * mutexes (see @ref grp_rt_critsect ). 44 * 40 45 * @ingroup grp_rt 41 46 * @{ … … 44 49 45 50 /** @defgroup grp_rt_sems_event RTSemEvent - Single Release Event Semaphores 51 * 52 * Event semaphores can be used for inter-process communication when 53 * one thread wants to notify another thread that something happened. 54 * A thread can block ("wait") on an event semaphore until it is 55 * signalled by another thread; see RTSemEventCreate, RTSemEventSignal 56 * and RTSemEventWait. 57 * 46 58 * @{ */ 47 59 … … 166 178 /** @defgroup grp_rt_sems_mutex RTMutex - Mutex semaphores. 167 179 * 168 * @remarks These can be pretty heavy handed. Fast mutexes or critical sections 169 * is usually what you need. 180 * Mutex semaphores protect a section of code or data to which access 181 * must be exclusive. Only one thread can hold access to a critical 182 * section at one time. See RTSemMutexCreate, RTSemMutexRequest and 183 * RTSemMutexRelease. 184 * 185 * @remarks These are less efficient than "fast mutexes" and "critical sections", 186 * which IPRT implements as well; see @ref grp_rt_sems_fast_mutex and 187 * @ref grp_rt_critsect . 170 188 * 171 189 * @{ */ … … 232 250 233 251 /** @defgroup grp_rt_sems_fast_mutex RTSemFastMutex - Fast Mutex Semaphores 252 * 253 * Fast mutexes work like regular mutexes in that they allow only 254 * a single thread access to a critical piece of code or data. 255 * As opposed to mutexes, they require no syscall if the fast mutex 256 * is not held (like critical sections). Unlike critical sections however, 257 * they are *not* recursive. 258 * 234 259 * @{ */ 235 260 … … 370 395 371 396 /** @defgroup grp_rt_sem_rw RTSemRW - Read / Write Semaphores 397 * 398 * Read/write semaphores are a fancier version of mutexes in that they 399 * grant read access to the protected data to several threads 400 * at the same time but allow only one writer at a time. This can make 401 * code scale better at the expense of slightly more overhead in 402 * mutex management. 403 * 372 404 * @{ */ 373 405
Note:
See TracChangeset
for help on using the changeset viewer.