Exemplo n.º 1
0
# -*- coding:gbk -*-
# auther : pdm
# email : [email protected]
import time
import mmap
import hbMmap

if __name__ == '__main__':
    print(__file__, 'test')

    map = hbMmap.init_mmap(mmap.ACCESS_READ)
    old_index = 0
    while True:
        index = hbMmap.getIndex(map)
        print('index', index, 'old', old_index)
        if index > old_index:
            for i in range(old_index + 1, index + 1):
                print(hbMmap.get(map, i))
                print()

        elif index < old_index:
            for i in range(old_index + 1, hbMmap.MAX_NUM + 1):
                print(hbMmap.get(map, i))
                print()
            for i in range(hbMmap.MIN_NUM, index + 1):
                print(hbMmap.get(map, i))
                print()
        else:
            time.sleep(5)
        old_index = index
Exemplo n.º 2
0
# -*- coding:gbk -*-
# auther : pdm
# email : [email protected]
import mmap
import hbMmap
import time

if __name__=='__main__':
    print(__file__, 'test')
    
    #hbMmap.init_mmap_file()
    map = hbMmap.init_mmap(mmap.ACCESS_WRITE)
    
    i = 0
    while True:
        hbMmap.writeNext(map, 'xxxxx %d'%i)
        i+=1
        time.sleep(1)
    
    
Exemplo n.º 3
0
# -*- coding:gbk -*-
# auther : pdm
# email : [email protected]
import time
import mmap
import hbMmap


if __name__=='__main__':
    print(__file__, 'test')
    
    map = hbMmap.init_mmap(mmap.ACCESS_READ)
    old_index = 0
    while True:
        index = hbMmap.getIndex(map)
        print('index', index, 'old', old_index)
        if index > old_index:
            for i in range(old_index+1, index+1):
                print(hbMmap.get(map, i))
                print()
            
        elif index < old_index:
            for i in range(old_index+1, hbMmap.MAX_NUM+1):
                print(hbMmap.get(map, i))
                print()
            for i in range(hbMmap.MIN_NUM, index+1):
                print(hbMmap.get(map, i))
                print()
        else:
            time.sleep(5)
        old_index = index