Re: QReadWriteLock Question
Until the lock becomes effective (that is until some thread actually "hangs" on the lock) it's just a memory structure. Later it depends on the implementation of locking mechanisms on a particular platform.
Re: QReadWriteLock Question
Quote:
Originally Posted by
wysota
Until the lock becomes effective (that is until some thread actually "hangs" on the lock) it's just a memory structure. Later it depends on the implementation of locking mechanisms on a particular platform.
Is it also just a memory structure after unlock? The actual time of the lock won't be long and it'll tend to be infrequent. Although I'm thinking of using many read write locks, they won't be locked at the same time.
Re: QReadWriteLock Question
Quote:
Originally Posted by
qtYoda
Is it also just a memory structure after unlock?
No, I don't think so. Once the semaphore is allocated it probably stays allocated until the object is destroyed. But you can verify that in the source code.
How many locks are we talking about? 1000? more?
Re: QReadWriteLock Question
Quote:
Originally Posted by
wysota
No, I don't think so. Once the semaphore is allocated it probably stays allocated until the object is destroyed. But you can verify that in the source code.
How many locks are we talking about? 1000? more?
Probably around 5000, but how many would actually be utilized, or even allocated would depend on the session. Probably not often near than many.
As followup, I was going to put the lock around a collection at the hash bucket level, rather than lock the whole collection when adding or removing. So there would be 1 per bucket.
Should I (or is it possible) just to have a semaphore that holds the read/write locks. I doubt I'd run into many instances of a lot of simultaneous writes to the collection.
Re: QReadWriteLock Question
It's easiest to just try and see.
Re: QReadWriteLock Question
Quote:
Originally Posted by
wysota
It's easiest to just try and see.
Yeah, I know. I've got to get my debugger situation squared away. Right now its incredibly limited.
Are there any white papers on setting up a good multithreaded debugging system with Qt Creator and VisualStudio 2010?
Re: QReadWriteLock Question
What's wrong with using gdb?
Re: QReadWriteLock Question
Well, I'm new to c++, visual studio, Qt, Qt creator and coding multi-threaded applications --- should I add GDB to that too? Is there any books/papers on how to setup gdb with Qt/VS2010 to debug?
Re: QReadWriteLock Question
You don't have to setup anything. Actually if you're using VS2010 and MSVC then you should use the native Visual Studio debugger. Just click on the "Debug"
button in the IDE to start debugging. You might want to set some breakpoints first.