~ubuntu-branches/ubuntu/oneiric/firebird2.5/oneiric-security

« back to all changes in this revision

Viewing changes to src/common/classes/semaphore.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Damyan Ivanov
  • Date: 2010-07-27 18:12:34 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100727181234-88lvl2nuord9ysx5
Tags: 2.5.0.26054~ReleaseCandidate3.ds2-1
* New upstream release candidate

* update d/copyright to reflect changes in upstream sources
* drop patches applied/implemented upstream
  + refresh the rest to apply cleanly
* Standards-Version: 3.9.1 (no changes necessary)

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
#ifdef COMMON_CLASSES_SEMAPHORE_MACH
35
35
 
36
 
        void SignalSafeSemaphore::machErrorCheck(kern_return_t rc, const char* fun)
 
36
        void SignalSafeSemaphore::init()
37
37
        {
38
 
                if (rc != KERN_SUCCESS)
 
38
                semaphore = dispatch_semaphore_create(0);
 
39
                if (!semaphore) // With const zero parameter this means OOM
39
40
                {
40
 
                        (Arg::Gds(isc_sys_request) << fun << Arg::Mach(static_cast<ISC_STATUS>(rc))).raise();
 
41
                        BadAlloc::raise();
41
42
                }
42
43
        }
43
44
 
44
 
        void SignalSafeSemaphore::init()
45
 
        {
46
 
                machErrorCheck(semaphore_create(mach_task_self(), &sem, SYNC_POLICY_FIFO, 0),
47
 
                                          "semaphore_create");
48
 
        }
49
 
 
50
45
        SignalSafeSemaphore::~SignalSafeSemaphore()
51
46
        {
52
 
                machErrorCheck(semaphore_destroy(mach_task_self(), sem), "semaphore_destroy");
 
47
                dispatch_release(semaphore);
53
48
        }
54
49
 
55
50
#endif  // COMMON_CLASSES_SEMAPHORE_MACH