~ubuntu-branches/ubuntu/raring/firebird2.5/raring-proposed

« back to all changes in this revision

Viewing changes to src/jrd/flu.h

  • Committer: Bazaar Package Importer
  • Author(s): Damyan Ivanov
  • Date: 2011-09-24 14:12:19 UTC
  • mfrom: (15.1.8 sid)
  • Revision ID: james.westby@ubuntu.com-20110924141219-pkxk7486f3d8ut9f
Tags: 2.5.1.26349-0~rc1.ds4-5
* Medium urgency for fixing a serious bug in testing

* Import a patch from upstream SVN fixing problems in poll() usage when
  process receives signals like SIGALRM.
  Closes: #642555 -- segfault in the remote interface when using alarm() in
  the client program

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
 
32
32
#include "../common/classes/objects_array.h"
33
33
#include "../jrd/os/mod_loader.h"
 
34
#include "../common/classes/fb_atomic.h"
34
35
 
35
36
namespace Jrd
36
37
{
42
43
                private:
43
44
                        InternalModule(const InternalModule &im);
44
45
                        void operator=(const InternalModule &im);
 
46
                        Firebird::AtomicCounter useCount;
45
47
 
46
48
                public:
47
 
                        long useCount;
48
49
                        ModuleLoader::Module* handle;
49
50
                        Firebird::PathName originalName, loadName;
50
51
 
57
58
                                return handle->findSymbol(name);
58
59
                        }
59
60
 
60
 
/*                      explicit InternalModule(MemoryPool& p)
61
 
                                : useCount(0), handle(0),
62
 
                                originalName(p), loadName(p)
63
 
                        { }
64
 
*/
65
61
                        InternalModule(MemoryPool& p,
66
62
                                                   ModuleLoader::Module* h,
67
63
                                                   const Firebird::PathName& on,
68
64
                                                   const Firebird::PathName& ln)
69
 
                                : useCount(0), handle(h),
70
 
                                        originalName(p, on), loadName(p, ln)
 
65
                                : handle(h), originalName(p, on), loadName(p, ln)
71
66
                        { }
72
67
 
73
68
                        ~InternalModule()
74
69
                        {
75
 
                                fb_assert(useCount == 0);
 
70
                                fb_assert(useCount.value() == 0);
76
71
                                delete handle;
77
72
                        }
78
73
 
81
76
                                return originalName == pn || loadName == pn;
82
77
                        }
83
78
 
84
 
                        bool inUse() const
85
 
                        {
86
 
                                return useCount > 0;
87
 
                        }
88
 
 
89
79
                        void acquire()
90
80
                        {
91
81
                                fb_assert(handle);
92
82
                                ++useCount;
93
83
                        }
94
84
 
95
 
                        void release()
 
85
                        int release()
96
86
                        {
97
 
                                fb_assert(useCount > 0);
98
 
                                --useCount;
 
87
                                fb_assert(useCount.value() > 0);
 
88
                                return --useCount;
99
89
                        }
100
90
                };
101
91