Search found 11 matches
- Wed Dec 03, 2008 3:56 am
- Forum: C++ Development
- Topic: Reference Pointer for wxStrings is not thread safe
- Replies: 3
- Views: 1429
Reference Pointer for wxStrings is not thread safe
The attached C++ program crashes rather horribly on my multi core system. It passes all wxStrings by VALUE so there should be no issues with concurrency. However, the underlying wxStringData object with reference counters is not thread safe. Note: Replacing the use of wxString with std::string in th...
- Tue Apr 17, 2007 10:38 pm
- Forum: C++ Development
- Topic: wxString objects are not Thread Safe
- Replies: 21
- Views: 4247
- Tue Apr 17, 2007 8:32 pm
- Forum: C++ Development
- Topic: wxString objects are not Thread Safe
- Replies: 21
- Views: 4247
The point is that the shared pointer implemented by wxString should be thread safe - not the contents of the data that is being pointed to. From reading this discussion, it would appear that the pointer returned by c_str() is safe so long as the original wxString wasn't sharing its data buffer with...
- Mon Apr 16, 2007 10:13 pm
- Forum: C++ Development
- Topic: wxString objects are not Thread Safe
- Replies: 21
- Views: 4247
The two mentioned problems are not real technical problems but conceptual issues and they can be avoided by using synchronization primitives (wxCriticalSection, etc) in user code. My opinion is not necessary to add any synchronization to wxString or other primitives like vectors, maps, etc, because...
- Mon Apr 16, 2007 8:27 pm
- Forum: C++ Development
- Topic: wxString objects are not Thread Safe
- Replies: 21
- Views: 4247
- Mon Apr 16, 2007 2:36 pm
- Forum: C++ Development
- Topic: wxString objects are not Thread Safe
- Replies: 21
- Views: 4247
Your right. The problem is with mb_str() or casting the wxString to (const char*). The scenario is the same.megabyte wrote:c_str does not modify any internal variablesCode: Select all
wxChar *m_pchData; ... const wxChar* c_str() const { return m_pchData; }
- Sun Apr 15, 2007 5:59 am
- Forum: C++ Development
- Topic: wxString objects are not Thread Safe
- Replies: 21
- Views: 4247
- Sun Apr 15, 2007 4:57 am
- Forum: C++ Development
- Topic: wxString objects are not Thread Safe
- Replies: 21
- Views: 4247
Because as thread A reads from the string using c_str(), thread B may be writing to the string. Granted c_str is a const-member function, thread B changed the data as A is reading from it, which basically will result in undefined behaviour. Joel No! This is not the case. Thread A initializes a stri...
- Fri Apr 13, 2007 9:52 pm
- Forum: C++ Development
- Topic: wxString objects are not Thread Safe
- Replies: 21
- Views: 4247
- Fri Apr 13, 2007 9:02 pm
- Forum: C++ Development
- Topic: wxString objects are not Thread Safe
- Replies: 21
- Views: 4247
This is essentially what we had to do. The fact that we had to do it was a big blow to the desire of several of our engineers in using wxWidgets. In fact a lot of the development using wxWidgets was stopped because of this. It took weeks to undo lots of development. It would be really nice if the re...
- Fri Apr 13, 2007 6:09 pm
- Forum: C++ Development
- Topic: wxString objects are not Thread Safe
- Replies: 21
- Views: 4247
wxString objects are not Thread Safe
I really like wxStrings. They provide a lot more functionality over std::string objects. We tried to use wsStrings in situations where multiple threads made read access to a single wxString. The result was catastrophe. Apparently the wxString keeps a local copy of a multibyte version of the string t...