Ticket #7420: boost_interprocess_errorTestCode.cpp

File boost_interprocess_errorTestCode.cpp, 10.7 KB (added by mimirang@…, 10 years ago)
Line 
1#include "stdafx.h"
2#include <afxwin.h>
3#include <iostream>
4#include <string>
5#include <fstream>
6#include <sys/timeb.h>
7#include <time.h>
8#include "test.h"
9#include "boostheader.h"
10#include <boost/interprocess/sync/file_lock.hpp>
11#include "io.h"
12
13using namespace boost::interprocess;
14namespace boostinter = boost::interprocess;
15using std::cout;
16using std::cin;
17using std::endl;
18
19void create_map(char* dbName);
20
21class SMTEST{
22
23public:
24 //so the allocator must allocate that pair.
25 typedef int KeyType;
26 typedef float MappedType;
27 typedef std::pair<const int, float> ValueType;
28 typedef allocator<ValueType, managed_shared_memory::segment_manager> ShmemAllocator;
29 typedef set<KeyType, std::less<KeyType>, ShmemAllocator> MySet;
30
31 managed_shared_memory *segment;
32 MySet *mymap;
33
34 SMTEST(char* dbName){
35
36 printf("dbName : %s\n",dbName);
37 try{
38 segment = new managed_shared_memory(open_or_create,"MySharedMemory",8000000);
39 ShmemAllocator alloc_inst (segment->get_segment_manager());
40 mymap = segment->find_or_construct<MySet>(dbName)(std::less<int>() ,alloc_inst); //second ctor parameter
41 printf("shared_memory size(%d) : create %s\n", segment->get_free_memory(), dbName);
42
43 }
44 catch(boostinter::interprocess_exception &ex){
45 std::cout << ex.what() << std::endl;
46 exit(1);
47 }
48
49 }
50
51};
52
53
54#define CREATE(dbName) \
55 SMTEST *m_##dbName; \
56 m_##dbName = new SMTEST(#dbName)
57
58
59int _tmain(int argc, _TCHAR* argv[]){
60
61 printf("start!!\n");
62 CREATE(DB1);
63 CREATE( DB2 );
64 CREATE( DB3 );
65 CREATE( DB4 );
66 CREATE( DB5 );
67 CREATE( DB6 );
68 CREATE( DB7 );
69 CREATE( DB8 );
70 CREATE( DB9 );
71 CREATE( DB10 );
72 CREATE( DB11 );
73 CREATE( DB12 );
74 CREATE( DB13 );
75 CREATE( DB14 );
76 CREATE( DB15 );
77 CREATE( DB16 );
78 CREATE( DB17 );
79 CREATE( DB18 );
80 CREATE( DB19 );
81 CREATE( DB20 );
82 CREATE( DB21 );
83 CREATE( DB22 );
84 CREATE( DB23 );
85 CREATE( DB24 );
86 CREATE( DB25 );
87 CREATE( DB26 );
88 CREATE( DB27 );
89 CREATE( DB28 );
90 CREATE( DB29 );
91 CREATE( DB30 );
92 CREATE( DB31 );
93 CREATE( DB32 );
94 CREATE( DB33 );
95 CREATE( DB34 );
96 CREATE( DB35 );
97 CREATE( DB36 );
98 CREATE( DB37 );
99 CREATE( DB38 );
100 CREATE( DB39 );
101 CREATE( DB40 );
102 CREATE( DB41 );
103 CREATE( DB42 );
104 CREATE( DB43 );
105 CREATE( DB44 );
106 CREATE( DB45 );
107 CREATE( DB46 );
108 CREATE( DB47 );
109 CREATE( DB48 );
110 CREATE( DB49 );
111 CREATE( DB50 );
112 CREATE( DB51 );
113 CREATE( DB52 );
114 CREATE( DB53 );
115 CREATE( DB54 );
116 CREATE( DB55 );
117 CREATE( DB56 );
118 CREATE( DB57 );
119 CREATE( DB58 );
120 CREATE( DB59 );
121 CREATE( DB60 );
122 CREATE( DB61 );
123 CREATE( DB62 );
124 CREATE( DB63 );
125 CREATE( DB64 );
126 CREATE( DB65 );
127 CREATE( DB66 );
128 CREATE( DB67 );
129 CREATE( DB68 );
130 CREATE( DB69 );
131 CREATE( DB70 );
132 CREATE( DB71 );
133 CREATE( DB72 );
134 CREATE( DB73 );
135 CREATE( DB74 );
136 CREATE( DB75 );
137 CREATE( DB76 );
138 CREATE( DB77 );
139 CREATE( DB78 );
140 CREATE( DB79 );
141 CREATE( DB80 );
142 CREATE( DB81 );
143 CREATE( DB82 );
144 CREATE( DB83 );
145 CREATE( DB84 );
146 CREATE( DB85 );
147 CREATE( DB86 );
148 CREATE( DB87 );
149 CREATE( DB88 );
150 CREATE( DB89 );
151 CREATE( DB90 );
152 CREATE( DB91 );
153 CREATE( DB92 );
154 CREATE( DB93 );
155 CREATE( DB94 );
156 CREATE( DB95 );
157 CREATE( DB96 );
158 CREATE( DB97 );
159 CREATE( DB98 );
160 CREATE( DB99 );
161 CREATE( DB100 );
162 CREATE( DB101 );
163 CREATE( DB102 );
164 CREATE( DB103 );
165 CREATE( DB104 );
166 CREATE( DB105 );
167 CREATE( DB106 );
168 CREATE( DB107 );
169 CREATE( DB108 );
170 CREATE( DB109 );
171 CREATE( DB110 );
172 CREATE( DB111 );
173 CREATE( DB112 );
174 CREATE( DB113 );
175 CREATE( DB114 );
176 CREATE( DB115 );
177 CREATE( DB116 );
178 CREATE( DB117 );
179 CREATE( DB118 );
180 CREATE( DB119 );
181 CREATE( DB120 );
182 CREATE( DB121 );
183 CREATE( DB122 );
184 CREATE( DB123 );
185 CREATE( DB124 );
186 CREATE( DB125 );
187 CREATE( DB126 );
188 CREATE( DB127 );
189 CREATE( DB128 );
190 CREATE( DB129 );
191 CREATE( DB130 );
192 CREATE( DB131 );
193 CREATE( DB132 );
194 CREATE( DB133 );
195 CREATE( DB134 );
196 CREATE( DB135 );
197 CREATE( DB136 );
198 CREATE( DB137 );
199 CREATE( DB138 );
200 CREATE( DB139 );
201 CREATE( DB140 );
202 CREATE( DB141 );
203 CREATE( DB142 );
204 CREATE( DB143 );
205 CREATE( DB144 );
206 CREATE( DB145 );
207 CREATE( DB146 );
208 CREATE( DB147 );
209 CREATE( DB148 );
210 CREATE( DB149 );
211 CREATE( DB150 );
212 CREATE( DB151 );
213 CREATE( DB152 );
214 CREATE( DB153 );
215 CREATE( DB154 );
216 CREATE( DB155 );
217 CREATE( DB156 );
218 CREATE( DB157 );
219 CREATE( DB158 );
220 CREATE( DB159 );
221 CREATE( DB160 );
222 CREATE( DB161 );
223 CREATE( DB162 );
224 CREATE( DB163 );
225 CREATE( DB164 );
226 CREATE( DB165 );
227 CREATE( DB166 );
228 CREATE( DB167 );
229 CREATE( DB168 );
230 CREATE( DB169 );
231 CREATE( DB170 );
232 CREATE( DB171 );
233 CREATE( DB172 );
234 CREATE( DB173 );
235 CREATE( DB174 );
236 CREATE( DB175 );
237 CREATE( DB176 );
238 CREATE( DB177 );
239 CREATE( DB178 );
240 CREATE( DB179 );
241 CREATE( DB180 );
242 CREATE( DB181 );
243 CREATE( DB182 );
244 CREATE( DB183 );
245 CREATE( DB184 );
246 CREATE( DB185 );
247 CREATE( DB186 );
248 CREATE( DB187 );
249 CREATE( DB188 );
250 CREATE( DB189 );
251 CREATE( DB190 );
252 CREATE( DB191 );
253 CREATE( DB192 );
254 CREATE( DB193 );
255 CREATE( DB194 );
256 CREATE( DB195 );
257 CREATE( DB196 );
258 CREATE( DB197 );
259 CREATE( DB198 );
260 CREATE( DB199 );
261 CREATE( DB200 );
262 CREATE( DB201 );
263 CREATE( DB202 );
264 CREATE( DB203 );
265 CREATE( DB204 );
266 CREATE( DB205 );
267 CREATE( DB206 );
268 CREATE( DB207 );
269 CREATE( DB208 );
270 CREATE( DB209 );
271 CREATE( DB210 );
272 CREATE( DB211 );
273 CREATE( DB212 );
274 CREATE( DB213 );
275 CREATE( DB214 );
276 CREATE( DB215 );
277 CREATE( DB216 );
278 CREATE( DB217 );
279 CREATE( DB218 );
280 CREATE( DB219 );
281 CREATE( DB220 );
282 CREATE( DB221 );
283 CREATE( DB222 );
284 CREATE( DB223 );
285 CREATE( DB224 );
286 CREATE( DB225 );
287 CREATE( DB226 );
288 CREATE( DB227 );
289 CREATE( DB228 );
290 CREATE( DB229 );
291 CREATE( DB230 );
292 CREATE( DB231 );
293 CREATE( DB232 );
294 CREATE( DB233 );
295 CREATE( DB234 );
296 CREATE( DB235 );
297 CREATE( DB236 );
298 CREATE( DB237 );
299 CREATE( DB238 );
300 CREATE( DB239 );
301 CREATE( DB240 );
302 CREATE( DB241 );
303 CREATE( DB242 );
304 CREATE( DB243 );
305 CREATE( DB244 );
306 CREATE( DB245 );
307 CREATE( DB246 );
308 CREATE( DB247 );
309 CREATE( DB248 );
310 CREATE( DB249 );
311 CREATE( DB250 );
312 CREATE( DB251 );
313 CREATE( DB252 );
314 CREATE( DB253 );
315 CREATE( DB254 );
316 CREATE( DB255 );
317 CREATE( DB256 );
318 CREATE( DB257 );
319 CREATE( DB258 );
320 CREATE( DB259 );
321 CREATE( DB260 );
322 CREATE( DB261 );
323 CREATE( DB262 );
324 CREATE( DB263 );
325 CREATE( DB264 );
326 CREATE( DB265 );
327 CREATE( DB266 );
328 CREATE( DB267 );
329 CREATE( DB268 );
330 CREATE( DB269 );
331 CREATE( DB270 );
332 CREATE( DB271 );
333 CREATE( DB272 );
334 CREATE( DB273 );
335 CREATE( DB274 );
336 CREATE( DB275 );
337 CREATE( DB276 );
338 CREATE( DB277 );
339 CREATE( DB278 );
340 CREATE( DB279 );
341 CREATE( DB280 );
342 CREATE( DB281 );
343 CREATE( DB282 );
344 CREATE( DB283 );
345 CREATE( DB284 );
346 CREATE( DB285 );
347 CREATE( DB286 );
348 CREATE( DB287 );
349 CREATE( DB288 );
350 CREATE( DB289 );
351 CREATE( DB290 );
352 CREATE( DB291 );
353 CREATE( DB292 );
354 CREATE( DB293 );
355 CREATE( DB294 );
356 CREATE( DB295 );
357 CREATE( DB296 );
358 CREATE( DB297 );
359 CREATE( DB298 );
360 CREATE( DB299 );
361 CREATE( DB300 );
362 CREATE( DB301 );
363 CREATE( DB302 );
364 CREATE( DB303 );
365 CREATE( DB304 );
366 CREATE( DB305 );
367 CREATE( DB306 );
368 CREATE( DB307 );
369 CREATE( DB308 );
370 CREATE( DB309 );
371 CREATE( DB310 );
372 CREATE( DB311 );
373 CREATE( DB312 );
374 CREATE( DB313 );
375 CREATE( DB314 );
376 CREATE( DB315 );
377 CREATE( DB316 );
378 CREATE( DB317 );
379 CREATE( DB318 );
380 CREATE( DB319 );
381 CREATE( DB320 );
382 CREATE( DB321 );
383 CREATE( DB322 );
384 CREATE( DB323 );
385 CREATE( DB324 );
386 CREATE( DB325 );
387 CREATE( DB326 );
388 CREATE( DB327 );
389 CREATE( DB328 );
390 CREATE( DB329 );
391 CREATE( DB330 );
392 CREATE( DB331 );
393 CREATE( DB332 );
394 CREATE( DB333 );
395 CREATE( DB334 );
396 CREATE( DB335 );
397 CREATE( DB336 );
398 CREATE( DB337 );
399 CREATE( DB338 );
400 CREATE( DB339 );
401 CREATE( DB340 );
402 CREATE( DB341 );
403 CREATE( DB342 );
404 CREATE( DB343 );
405 CREATE( DB344 );
406 CREATE( DB345 );
407 CREATE( DB346 );
408 CREATE( DB347 );
409 CREATE( DB348 );
410 CREATE( DB349 );
411 CREATE( DB350 );
412 CREATE( DB351 );
413 CREATE( DB352 );
414 CREATE( DB353 );
415 CREATE( DB354 );
416 CREATE( DB355 );
417 CREATE( DB356 );
418 CREATE( DB357 );
419 CREATE( DB358 );
420 CREATE( DB359 );
421 CREATE( DB360 );
422 CREATE( DB361 );
423 CREATE( DB362 );
424 CREATE( DB363 );
425 CREATE( DB364 );
426 CREATE( DB365 );
427 CREATE( DB366 );
428 CREATE( DB367 );
429 CREATE( DB368 );
430 CREATE( DB369 );
431 CREATE( DB370 );
432 CREATE( DB371 );
433 CREATE( DB372 );
434 CREATE( DB373 );
435 CREATE( DB374 );
436 CREATE( DB375 );
437 CREATE( DB376 );
438 CREATE( DB377 );
439 CREATE( DB378 );
440 CREATE( DB379 );
441 CREATE( DB380 );
442 CREATE( DB381 );
443 CREATE( DB382 );
444 CREATE( DB383 );
445 CREATE( DB384 );
446 CREATE( DB385 );
447 CREATE( DB386 );
448 CREATE( DB387 );
449 CREATE( DB388 );
450 CREATE( DB389 );
451 CREATE( DB390 );
452 CREATE( DB391 );
453 CREATE( DB392 );
454 CREATE( DB393 );
455 CREATE( DB394 );
456 CREATE( DB395 );
457 CREATE( DB396 );
458 CREATE( DB397 );
459 CREATE( DB398 );
460 CREATE( DB399 );
461 CREATE( DB400 );
462 CREATE( DB401 );
463 CREATE( DB402 );
464 CREATE( DB403 );
465 CREATE( DB404 );
466 CREATE( DB405 );
467 CREATE( DB406 );
468 CREATE( DB407 );
469 CREATE( DB408 );
470 CREATE( DB409 );
471 CREATE( DB410 );
472 CREATE( DB411 );
473 CREATE( DB412 );
474 CREATE( DB413 );
475 CREATE( DB414 );
476 CREATE( DB415 );
477 CREATE( DB416 );
478 CREATE( DB417 );
479 CREATE( DB418 );
480 CREATE( DB419 );
481 CREATE( DB420 );
482 CREATE( DB421 );
483 CREATE( DB422 );
484 CREATE( DB423 );
485 CREATE( DB424 );
486 CREATE( DB425 );
487 CREATE( DB426 );
488 CREATE( DB427 );
489 CREATE( DB428 );
490 CREATE( DB429 );
491 CREATE( DB430 );
492 CREATE( DB431 );
493 CREATE( DB432 );
494 CREATE( DB433 );
495 CREATE( DB434 );
496 CREATE( DB435 );
497 CREATE( DB436 );
498 CREATE( DB437 );
499 CREATE( DB438 );
500 CREATE( DB439 );
501 CREATE( DB440 );
502 CREATE( DB441 );
503 CREATE( DB442 );
504 CREATE( DB443 );
505 CREATE( DB444 );
506 CREATE( DB445 );
507 CREATE( DB446 );
508 CREATE( DB447 );
509 CREATE( DB448 );
510 CREATE( DB449 );
511 CREATE( DB450 );
512 CREATE( DB451 );
513 CREATE( DB452 );
514 CREATE( DB453 );
515 CREATE( DB454 );
516 CREATE( DB455 );
517 CREATE( DB456 );
518 CREATE( DB457 );
519 CREATE( DB458 );
520 CREATE( DB459 );
521 CREATE( DB460 );
522 CREATE( DB461 );
523 CREATE( DB462 );
524 CREATE( DB463 );
525 CREATE( DB464 );
526 CREATE( DB465 );
527 CREATE( DB466 );
528 CREATE( DB467 );
529 CREATE( DB468 );
530 CREATE( DB469 );
531 CREATE( DB470 );
532 CREATE( DB471 );
533 CREATE( DB472 );
534 CREATE( DB473 );
535 CREATE( DB474 );
536 CREATE( DB475 );
537 CREATE( DB476 );
538 CREATE( DB477 );
539 CREATE( DB478 );
540 CREATE( DB479 );
541 CREATE( DB480 );
542 CREATE( DB481 );
543 CREATE( DB482 );
544 CREATE( DB483 );
545 CREATE( DB484 );
546 CREATE( DB485 );
547 CREATE( DB486 );
548 CREATE( DB487 );
549 CREATE( DB488 );
550 CREATE( DB489 );
551 CREATE( DB490 );
552 CREATE( DB491 );
553 CREATE( DB492 );
554 CREATE( DB493 );
555 CREATE( DB494 );
556 CREATE( DB495 );
557 CREATE( DB496 );
558 CREATE( DB497 );
559 CREATE( DB498 );
560 CREATE( DB499 );
561 CREATE( DB500 );
562
563 while(1)
564 {
565 Sleep(10);
566 }
567
568}