Share Symbian RFile between two streams

in a multi-threaded application, I transfer to Symbian using Open C, I have an object that uses RFile to read / write data to a file. This object must be accessible from different threads (it is thread safe), however there is a problem that, apparently, RFile objects can be accessed in only one thread. As soon as another thread uses the RFile object, I get KERN-EXEC 0.

Is there a way to split an RFile object between different threads? I can not use Active Objects.

+3
source share
3 answers

Create a second RFile descriptor (call the second file on it). Do not open it. Use RFile :: Duplicate (secondFile) instead. All threads in your process should be able to use a second script after this.

+3
source

Using RFs :: ShareAuto () seems to work.

+1
source

:

  • RFile::TransferToClient(const RMessage2 &,TInt)const
    
  • RFile::TransferToProcess(RProcess &,TInt,TInt)const
    
  • RFile::TransferToServer(TIpcArgs &,TInt,TInt)const
    

//

  •  

    RFile::AdoptFromClient(const RMessage2 &,TInt,TInt)
    
  •  

    RFile::AdoptFromCreator(TInt,TInt)
    
  • RFile::AdoptFromServer(TInt,TInt)
    

.. . , .

RFile::Duplicate(const RFile &,TOwnerType)
0

Source: https://habr.com/ru/post/1698508/


All Articles