×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Apr 2011
    Posts
    181

    Protect shared resources by RCriticalSection in a QThread

    Hi all
    I have a class that has a TDes as a buffer. In this class i fill it with some data. In another thread, implemented by QThread, I read and clear the mentioned buffer. I protect the buffer between two threads by means of a RCriticalSection object. Since I get KERN-EXEC 0 error, do I need to protect the buffer by classes like QMutex, Q.. ?

    Thanks.
    O people of the world, Imam Hussein was killed in Karbala in thirsty.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,692

    Re: Protect shared resources by RCriticalSection in a QThread

    If you are using Qt, you may rather choose relying on Qt syncronization/exclusion API-s, which are probably closer to standard C/C++.
    Side note: if you really have a TDes member variable somewhere, forget it quickly: TDes should not be used as a value type as it does not store content. Safe usages of TDes and TDesC are pointers and references only (like specifying a "TDesC &aDesC" argument for a method).
    If you need a fixed-size descriptor as buffer, use TBuf. For dynamic sizing RBuf or HBufC.

  3. #3
    Regular Contributor
    Join Date
    Apr 2011
    Posts
    181

    Re: Protect shared resources by RCriticalSection in a QThread

    Thanks for your help.
    O people of the world, Imam Hussein was killed in Karbala in thirsty.

Similar Threads

  1. Using QHttp with Qthread
    By schroffi in forum Qt
    Replies: 2
    Last Post: 2011-06-09, 16:39
  2. Replies: 1
    Last Post: 2010-08-12, 10:27
  3. How to protect resources?
    By martinceronio in forum Mobile Java General
    Replies: 4
    Last Post: 2009-08-31, 07:08
  4. RCriticalSection question.
    By colinlawrence in forum Symbian
    Replies: 2
    Last Post: 2004-03-03, 15:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×