Changeset 350 in pacpusframework for trunk/src/PacpusTools


Ignore:
Timestamp:
10/15/15 14:40:14 (9 years ago)
Author:
nguyenhu
Message:

add Zoe types and shared memory for linux

Location:
trunk/src/PacpusTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/PacpusTools/CMakeLists.txt

    r300 r350  
    3636    ${PACPUS_INCLUDE_DIR}/Pacpus/PacpusTools/PeriodicWorker.h
    3737    ${PACPUS_INCLUDE_DIR}/Pacpus/PacpusTools/SharedMemory.h
     38    ${PACPUS_INCLUDE_DIR}/Pacpus/PacpusTools/PosixShMem.h
    3839
    3940    #${PACPUS_INCLUDE_DIR}/Pacpus/PacpusTools/pacpusStruct.h
     
    4849    #src/PacpusSerialPort.cpp
    4950    src/SharedMemory.cpp
     51    src/PosixShMem.cpp
    5052)
    5153
  • trunk/src/PacpusTools/src/PosixShMem.cpp

    r312 r350  
    104104
    105105//////////////////////////////////////////////////////////////////////////
    106 /// Use this method to get the data of the shared memory
     106/// Use this method to get a pointer to data of the shared memory
    107107void * PosixShMem::read()
    108108{
    109     return shMem_;
     109    void * shMem;
     110    lockMemory();
     111    shMem = shMem_;
     112    unlockMemory();
     113    return shMem;
     114}
     115
     116//////////////////////////////////////////////////////////////////////////
     117/// Use this method to get a pointer to data of the shared memory
     118void PosixShMem::read(void * mem, int size)
     119{
     120    lockMemory();
     121    memcpy(mem,shMem_,size);
     122    unlockMemory();
    110123}
    111124
Note: See TracChangeset for help on using the changeset viewer.