~ubuntu-branches/ubuntu/trusty/virtualbox-ose/trusty

« back to all changes in this revision

Viewing changes to include/iprt/semaphore.h

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 */
43
43
 
44
44
 
 
45
/** @defgroup grp_rt_sems_event    RTSemEvent - Single Release Event Semaphores
 
46
 * @{ */
 
47
 
45
48
/**
46
49
 * Create a event semaphore.
47
50
 *
94
97
 */
95
98
RTDECL(int)  RTSemEventWaitNoResume(RTSEMEVENT EventSem, unsigned cMillies);
96
99
 
97
 
 
 
100
/** @} */
 
101
 
 
102
 
 
103
/** @defgroup grp_rt_sems_event_multi   RTSemEventMulti - Multiple Release Event Semaphores
 
104
 * @{ */
98
105
 
99
106
/**
100
107
 * Create a event multi semaphore.
153
160
 */
154
161
RTDECL(int)  RTSemEventMultiWaitNoResume(RTSEMEVENTMULTI EventMultiSem, unsigned cMillies);
155
162
 
156
 
 
 
163
/** @} */
 
164
 
 
165
 
 
166
/** @defgroup grp_rt_sems_mutex     RTMutex - Mutex semaphores.
 
167
 *
 
168
 * @remarks These can be pretty heavy handed. Fast mutexes or critical sections
 
169
 *          is usually what you need.
 
170
 *
 
171
 * @{ */
157
172
 
158
173
/**
159
174
 * Create a mutex semaphore.
212
227
 */
213
228
RTDECL(int)  RTSemMutexRelease(RTSEMMUTEX MutexSem);
214
229
 
 
230
/** @} */
 
231
 
 
232
 
 
233
/** @defgroup grp_rt_sems_fast_mutex    RTSemFastMutex - Fast Mutex Semaphores
 
234
 * @{ */
215
235
 
216
236
/**
217
237
 * Create a fast mutex semaphore.
252
272
 */
253
273
RTDECL(int)  RTSemFastMutexRelease(RTSEMFASTMUTEX MutexSem);
254
274
 
 
275
/** @} */
 
276
 
 
277
 
 
278
/** @defgroup grp_rt_sems_spin_mutex RTSemSpinMutex - Spinning Mutex Semaphores
 
279
 *
 
280
 * Very adaptive kind of mutex semaphore tailored for the ring-0 logger.
 
281
 *
 
282
 * @{ */
 
283
 
 
284
/**
 
285
 * Creates a spinning mutex semaphore.
 
286
 *
 
287
 * @returns iprt status code.
 
288
 * @retval  VERR_INVALID_PARAMETER on invalid flags.
 
289
 * @retval  VERR_NO_MEMORY if out of memory for the semaphore structure and
 
290
 *          handle.
 
291
 *
 
292
 * @param   phSpinMtx   Where to return the handle to the create semaphore.
 
293
 * @param   fFlags      Flags, see RTSEMSPINMUTEX_FLAGS_XXX.
 
294
 */
 
295
RTDECL(int) RTSemSpinMutexCreate(PRTSEMSPINMUTEX phSpinMtx, uint32_t fFlags);
 
296
 
 
297
/** @name RTSemSpinMutexCreate flags.
 
298
 * @{ */
 
299
/** Always take the semaphore in a IRQ safe way.
 
300
 * (In plain words: always disable interrupts.) */
 
301
#define RTSEMSPINMUTEX_FLAGS_IRQ_SAFE       RT_BIT_32(0)
 
302
/** Mask of valid flags. */
 
303
#define RTSEMSPINMUTEX_FLAGS_VALID_MASK     UINT32_C(0x00000001)
 
304
/** @} */
 
305
 
 
306
/**
 
307
 * Destroys a spinning mutex semaphore.
 
308
 *
 
309
 * @returns iprt status code.
 
310
 * @retval  VERR_INVALID_HANDLE (or crash) if the handle is invalid. (NIL will
 
311
 *          not cause this status.)
 
312
 *
 
313
 * @param   hSpinMtx    The semaphore handle. NIL_RTSEMSPINMUTEX is ignored
 
314
 *                      quietly (VINF_SUCCESS).
 
315
 */
 
316
RTDECL(int) RTSemSpinMutexDestroy(RTSEMSPINMUTEX hSpinMtx);
 
317
 
 
318
/**
 
319
 * Request the spinning mutex semaphore.
 
320
 *
 
321
 * This may block if the context we're called in allows this. If not it will
 
322
 * spin. If called in an interrupt context, we will only spin if the current
 
323
 * owner isn't interrupted. Also, on some systems it is not always possible to
 
324
 * wake up blocking threads in all contexts, so, which will either be indicated
 
325
 * by returning VERR_SEM_BAD_CONTEXT or by temporarily switching the semaphore
 
326
 * into pure spinlock state.
 
327
 *
 
328
 * Preemption will be disabled upon return. IRQs may also be disabled.
 
329
 *
 
330
 * @returns iprt status code.
 
331
 * @retval  VERR_SEM_BAD_CONTEXT if the context it's called in isn't suitable
 
332
 *          for releasing it if someone is sleeping on it.
 
333
 * @retval  VERR_SEM_DESTROYED if destroyed.
 
334
 * @retval  VERR_SEM_NESTED if held by the caller. Asserted.
 
335
 * @retval  VERR_INVALID_HANDLE if the handle is invalid. Asserted
 
336
 *
 
337
 * @param   hSpinMtx    The semaphore handle.
 
338
 */
 
339
RTDECL(int) RTSemSpinMutexRequest(RTSEMSPINMUTEX hSpinMtx);
 
340
 
 
341
/**
 
342
 * Like RTSemSpinMutexRequest but it won't block or spin if the semaphore is
 
343
 * held by someone else.
 
344
 *
 
345
 * @returns iprt status code.
 
346
 * @retval  VERR_SEM_BUSY if held by someone else.
 
347
 * @retval  VERR_SEM_DESTROYED if destroyed.
 
348
 * @retval  VERR_SEM_NESTED if held by the caller. Asserted.
 
349
 * @retval  VERR_INVALID_HANDLE if the handle is invalid. Asserted
 
350
 *
 
351
 * @param   hSpinMtx    The semaphore handle.
 
352
 */
 
353
RTDECL(int) RTSemSpinMutexTryRequest(RTSEMSPINMUTEX hSpinMtx);
 
354
 
 
355
/**
 
356
 * Releases the semaphore previously acquired by RTSemSpinMutexRequest or
 
357
 * RTSemSpinMutexTryRequest.
 
358
 *
 
359
 * @returns iprt status code.
 
360
 * @retval  VERR_SEM_DESTROYED if destroyed.
 
361
 * @retval  VERR_NOT_OWNER if not owner. Asserted.
 
362
 * @retval  VERR_INVALID_HANDLE if the handle is invalid. Asserted.
 
363
 *
 
364
 * @param   hSpinMtx    The semaphore handle.
 
365
 */
 
366
RTDECL(int) RTSemSpinMutexRelease(RTSEMSPINMUTEX hSpinMtx);
 
367
 
 
368
/** @} */
 
369
 
 
370
 
 
371
/** @defgroup grp_rt_sem_rw             RTSemRW - Read / Write Semaphores
 
372
 * @{ */
255
373
 
256
374
/**
257
375
 * Creates a read/write semaphore.
364
482
 */
365
483
RTDECL(uint32_t) RTSemRWGetWriterReadRecursion(RTSEMRW RWSem);
366
484
 
367
 
 
 
485
/** @} */
 
486
 
 
487
 
 
488
/** @defgroup grp_rt_sems_pingpong      RTSemPingPong - Ping-Pong Construct
 
489
 * @{ */
368
490
 
369
491
/**
370
492
 * Ping-pong speaker
523
645
        || enmSpeaker == RTPINGPONGSPEAKER_PONG_SIGNALED;
524
646
}
525
647
 
 
648
/** @} */
526
649
 
527
650
/** @} */
528
651