File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ To be simple and fast, when it allocate a buffer it will never use the buffer ag
21
21
1000, // shared memory max size
22
22
true); // reset shared memory flag
23
23
24
- TestNode* buffer = (TestNode*)shm.Allocate(50 ); // allocate memory just like malloc
24
+ TestNode* buffer = (TestNode*)shm.Allocate(sizeof(TestNode) ); // allocate memory just like malloc
25
25
~~~~
26
26
27
27
@@ -45,10 +45,13 @@ Easy to use is the most important !
45
45
#include "container/shm_manager.h"
46
46
#include "container/lockfree_skiplist.h"
47
47
48
- area::ShmArea area = area::ShmArea("test_shared_memory_dat", 10000000, true);
49
- // shm_manager for conatiner just for the interface can be easy to use
50
- container::ShmManager* shm_manager = new container::ShmManager(&area);
51
- container::LockFreeSkipList<int> list(shm_manager, true);
48
+ auto area = area::ShmArea("test_shared_memory_dat",
49
+ 10000000,
50
+ true); // If you want to open from exist memory, just pass false
51
+
52
+ auto* shm_manager = new container::ShmManager(&area);
53
+
54
+ container::LockFreeSkipList<int> list(shm_manager, true); // If you want to open from exist skiplist, just pass false
52
55
53
56
for (int i=0; i<20000; ++i) {
54
57
list.Add(i);
You can’t perform that action at this time.
0 commit comments