~ubuntu-branches/ubuntu/vivid/virtualbox-ose/vivid

« back to all changes in this revision

Viewing changes to src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-10-13 23:06:00 UTC
  • mfrom: (0.3.2 upstream) (0.1.12 sid)
  • Revision ID: james.westby@ubuntu.com-20091013230600-xhu2pwizq0wo63l9
Tags: 3.0.8-dfsg-1ubuntu1
* Merge from debian unstable (LP: #444812), remaining changes:
  - Enable DKMS support on virtualbox host and guest modules (LP: #267097)
    - Drop virtualbox-ose{-guest,}-modules-* package templates
    - Recommend *-source instead of *-modules packages
    - Replace error messages related to missing/mismatched
      kernel module accordingly
  - Autoload kernel module
    - LOAD_VBOXDRV_MODULE=1 in virtualbox-ose.default
  - Disable update action
    - patches/u01-disable-update-action.dpatch
  - Virtualbox should go in Accessories, not in System tools (LP: #288590)
    - virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add apport hook
    - virtualbox-ose.files/source_virtualbox-ose.py
    - virtualbox-ose.install
  - Add launchpad integration
    - control
    - lpi-bug.xpm
    - patches/u02-lp-integration.dpatch
* Try to remove existing dkms modules before adding the new modules
  (LP: #434503)
  - debian/virtualbox-ose-source.postinst
  - debian/virtualbox-ose-guest-source.postinst
* Don't fail if dkms modules have already been removed
  - debian/virtualbox-ose-source.prerm
  - debian/virtualbox-ose-guest-source.prerm

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
#include <iprt/assert.h>
39
39
#include <iprt/asm.h>
40
40
#include <iprt/err.h>
 
41
#include <iprt/thread.h>
41
42
 
42
43
#include "internal/magics.h"
43
44
 
129
130
    AssertMsgReturn(pEventInt->u32Magic == RTSEMEVENT_MAGIC,
130
131
                    ("pEventInt=%p u32Magic=%#x\n", pEventInt, pEventInt->u32Magic),
131
132
                    VERR_INVALID_HANDLE);
132
 
 
133
 
    mutex_enter(&pEventInt->Mtx);
 
133
    /*
 
134
     * If we're in interrupt context we need to unpin the underlying current
 
135
     * thread as this could lead to a deadlock (see #4259 for the full explanation)
 
136
     *
 
137
     * Note! This assumes nobody is using the RTThreadPreemptDisable in an
 
138
     *       interrupt context and expects it to work right.  The swtch will
 
139
     *       result in a voluntary preemption.  To fix this, we would have to
 
140
     *       do our own counting in RTThreadPreemptDisable/Restore like we do
 
141
     *       on systems which doesn't do preemption (OS/2, linux, ...) and
 
142
     *       check whether preemption was disabled via RTThreadPreemptDisable
 
143
     *       or not and only call swtch if RTThreadPreemptDisable wasn't called.
 
144
     */
 
145
    int fAcquired = mutex_tryenter(&pEventInt->Mtx);
 
146
    if (!fAcquired)
 
147
    {
 
148
        if (curthread->t_intr && getpil() < DISP_LEVEL)
 
149
        {
 
150
            RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
 
151
            RTThreadPreemptDisable(&PreemptState);
 
152
            preempt();
 
153
            RTThreadPreemptRestore(&PreemptState);
 
154
        }
 
155
        mutex_enter(&pEventInt->Mtx);
 
156
    }
134
157
 
135
158
    if (pEventInt->cWaiters > 0)
136
159
    {