~ubuntu-branches/ubuntu/utopic/xulrunner-1.9/utopic

« back to all changes in this revision

Viewing changes to mozilla/nsprpub/pr/src/md/os2/os2cv.c

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack, Alexander Sack, Fabien Tassin
  • Date: 2009-02-05 09:12:37 UTC
  • mfrom: (1.1.16 upstream)
  • Revision ID: james.westby@ubuntu.com-20090205091237-2uu65i47p00yi2xk
Tags: 1.9.0.6+nobinonly-0ubuntu1
[ Alexander Sack <asac@ubuntu.com> ]
* new security/stability update v1.9.0.6 (FIREFOX_3_0_6_RELEASE)
  - see USN-717-1
* adjust patches to changed code base
  - update debian/patches/dom_inspector_support_for_prism.patch

[ Fabien Tassin <fta@ubuntu.com> ]
* Fix preinst script to better handle the /etc/gre.d clean-up
  - update debian/xulrunner-1.9.preinst.in
* Fix permissions in the -dev package (LP: #303940)
  - update debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
 
52
52
#include "primpl.h"
53
53
 
54
 
#ifdef USE_RAMSEM
55
 
ULONG _Far16 _Pascal Dos16GetInfoSeg(PSEL pselGlobal, PSEL pselLocal);
56
 
 
57
 
#ifdef XP_OS2_EMX
58
 
typedef unsigned short BOOL16;
59
 
#endif
60
 
 
61
 
typedef struct _LINFOSEG
62
 
{
63
 
    USHORT  pidCurrent;
64
 
    USHORT  pidParent;
65
 
    USHORT  prtyCurrent;
66
 
    USHORT  tidCurrent;
67
 
    USHORT  sgCurrent;
68
 
    UCHAR   rfProcStatus;
69
 
    UCHAR   dummy1;
70
 
    BOOL16  fForeground;
71
 
    UCHAR   typProcess;
72
 
    UCHAR   dummy2;
73
 
    SEL     selEnvironment;
74
 
    USHORT  offCmdLine;
75
 
    USHORT  cbDataSegment;
76
 
    USHORT  cbStack;
77
 
    USHORT  cbHeap;
78
 
    USHORT  hmod;
79
 
    SEL     selDS;
80
 
    SEL     selPack;
81
 
    SEL     selPackShr;
82
 
    SEL     selPackPck;
83
 
    ULONG   ulReserved;
84
 
} LINFOSEG;
85
 
typedef LINFOSEG FAR *PLINFOSEG;
86
 
 
87
 
PLINFOSEG plisCurrent = NULL;
88
 
#endif
89
 
 
90
54
/*
91
55
 * AddThreadToCVWaitQueueInternal --
92
56
 *
202
166
    }
203
167
 
204
168
    /* Release the lock before notifying */
205
 
#ifdef USE_RAMSEM
206
 
      SemReleasex86(&lock->mutex, 0);
207
 
#else
208
 
      DosReleaseMutexSem(lock->mutex);
209
 
#endif
 
169
    DosReleaseMutexSem(lock->mutex);
210
170
 
211
171
    notified = &post;  /* this is where we start */
212
172
    do {
313
273
        md_UnlockAndPostNotifies(lock, thred, cv);
314
274
    } else {
315
275
        AddThreadToCVWaitQueueInternal(thred, cv);
316
 
#ifdef USE_RAMSEM
317
 
        SemReleasex86( &lock->mutex, 0 );
318
 
#else
319
276
        DosReleaseMutexSem(lock->mutex); 
320
 
#endif
321
277
    }
322
278
 
323
279
    /* Wait for notification or timeout; don't really care which */
326
282
        DosResetEventSem(thred->md.blocked_sema, &count);
327
283
    }
328
284
 
329
 
#ifdef USE_RAMSEM
330
 
    SemRequest486(&(lock->mutex), -1);
331
 
#else
332
285
    DosRequestMutexSem((lock->mutex), SEM_INDEFINITE_WAIT);
333
 
#endif
334
286
 
335
287
    PR_ASSERT(rv == NO_ERROR || rv == ERROR_TIMEOUT);
336
288
 
387
339
PRStatus
388
340
_PR_MD_NEW_LOCK(_MDLock *lock)
389
341
{
390
 
#ifdef USE_RAMSEM
391
 
    // It's better if this API traps when pCriticalSect is not a valid
392
 
    // pointer, because we can't return an error code and if we just return
393
 
    // the API caller will have nasty bugs that are hard to find.
394
 
   
395
 
    PRAMSEM pramsem = (PRAMSEM)(&(lock->mutex));
396
 
    /* First time, set up addresses of processor specific functions
397
 
     */
398
 
    if (plisCurrent == NULL)
399
 
    {
400
 
        SEL selGlobal = 0, selLocal = 0;
401
 
   
402
 
        /* Convert 16 bit global information segment to 32 bit address
403
 
         * by performing CRMA on the 16 bit address: "shift" operation
404
 
         * to convert sel to flat, "and" operation to mask the address
405
 
         * to 32-bit
406
 
         */
407
 
        Dos16GetInfoSeg(&selGlobal, &selLocal);
408
 
        plisCurrent = (PLINFOSEG)(((ULONG)selLocal << 13) &
409
 
                      (ULONG)0x1fff0000);
410
 
   
411
 
    }
412
 
   
413
 
    memset(pramsem, 0, sizeof(pramsem));
414
 
    DosCreateEventSem(0, &pramsem->hevSem, DC_SEM_SHARED, 0);
415
 
   
416
 
    lock->notified.length=0;
417
 
    lock->notified.link=NULL;
418
 
    return PR_SUCCESS;
419
 
#else
420
342
    DosCreateMutexSem(0, &(lock->mutex), 0, 0);
421
343
    (lock)->notified.length=0;
422
344
    (lock)->notified.link=NULL;
423
345
    return PR_SUCCESS;
424
 
#endif
425
346
}
426
347
 
427
348
void