~vlad-lesin/percona-server/mysql-5.0.33-original

« back to all changes in this revision

Viewing changes to ndb/src/kernel/vm/LongSignal.hpp

  • Committer: Vlad Lesin
  • Date: 2012-07-31 09:21:34 UTC
  • Revision ID: vladislav.lesin@percona.com-20120731092134-zfodx022b7992wsi
VirginĀ 5.0.33

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2003 MySQL AB
 
2
 
 
3
   This program is free software; you can redistribute it and/or modify
 
4
   it under the terms of the GNU General Public License as published by
 
5
   the Free Software Foundation; either version 2 of the License, or
 
6
   (at your option) any later version.
 
7
 
 
8
   This program is distributed in the hope that it will be useful,
 
9
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
   GNU General Public License for more details.
 
12
 
 
13
   You should have received a copy of the GNU General Public License
 
14
   along with this program; if not, write to the Free Software
 
15
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
16
 
 
17
#ifndef LONG_SIGNAL_HPP
 
18
#define LONG_SIGNAL_HPP
 
19
 
 
20
#include "pc.hpp"
 
21
#include <ArrayPool.hpp>
 
22
 
 
23
/**
 
24
 * Section handling
 
25
 */
 
26
struct SectionSegment {
 
27
 
 
28
  STATIC_CONST( DataLength = NDB_SECTION_SEGMENT_SZ );
 
29
  
 
30
  Uint32 m_ownerRef;
 
31
  Uint32 m_sz;
 
32
  Uint32 m_lastSegment;
 
33
  union {
 
34
    Uint32 m_nextSegment;
 
35
    Uint32 nextPool;
 
36
  };
 
37
  Uint32 theData[DataLength];
 
38
};
 
39
 
 
40
/**
 
41
 * Pool for SectionSegments
 
42
 */
 
43
class SectionSegmentPool : public ArrayPool<SectionSegment> {};
 
44
 
 
45
/**
 
46
 * And the instance
 
47
 */
 
48
extern SectionSegmentPool g_sectionSegmentPool;
 
49
 
 
50
/**
 
51
 * Function prototypes
 
52
 */
 
53
void print(SegmentedSectionPtr ptr, FILE* out);
 
54
void copy(SegmentedSectionPtr dst, Uint32 * src, Uint32 len);
 
55
void copy(Uint32 * dst, SegmentedSectionPtr src);
 
56
 
 
57
extern class SectionSegmentPool g_sectionSegmentPool;
 
58
void getSection(SegmentedSectionPtr & ptr, Uint32 id);
 
59
void linkSegments(Uint32 head, Uint32 tail);
 
60
 
 
61
void getSections(Uint32 secCount, SegmentedSectionPtr ptr[3]);
 
62
void releaseSections(Uint32 secCount, SegmentedSectionPtr ptr[3]);
 
63
 
 
64
 
 
65
#include "DataBuffer.hpp"
 
66
 
 
67
template<Uint32 sz>
 
68
void
 
69
append(DataBuffer<sz>& dst, SegmentedSectionPtr ptr, SectionSegmentPool& pool){
 
70
  Uint32 len = ptr.sz;
 
71
  while(len > SectionSegment::DataLength){
 
72
    dst.append(ptr.p->theData, SectionSegment::DataLength);
 
73
    ptr.p = pool.getPtr(ptr.p->m_nextSegment);
 
74
    len -= SectionSegment::DataLength;
 
75
  }
 
76
  dst.append(ptr.p->theData, len);
 
77
}
 
78
 
 
79
#endif