The attached source contains an atc-oop implementation of CVector.
It's a dword array management class with access methods that make it feel similar to using a stack, with the exception of the "delete" method, which is used to delete a dword by index from anywhere in the array, causing the trailing entries to be shuffled down to fill the gap...
Posted on 2004-06-09 02:15:24 by Homer
CVector was modified - I've written several variants of this class now, but I still use this one and regularly, and it needed something..

Instances of this class now contain a CriticalSection Lock, which means that all the Methods of this class (except the constructor and destructor) will now BLOCK if another thread is currently executing any of its Methods at that moment.
When you first call one of these Methods, the instance will Lock itself until the Method has completed. The first call will not block, but subsequent calls will, until the object Unlocks itself.
The reason I did this is because if we access the same instance from multiple threads, we need to ensure that the object's data remains valid for both threads.
Imagine for example, one thread is allocating memory and storing pointers in a CVector object, another thread is freeing memory and deleting pointers from the CVector object instance .. the array count (number of pointers stored in CVector object) can become invalid due to one thread modifying it while another isn't watching, and that is just a basic example of what can go wrong with accessing objects across threads...
Posted on 2004-08-03 09:10:22 by Homer
semaphore :D
Posted on 2004-08-03 10:50:16 by wizzra
I'm not sure about Semaphore, but this is for sure a lot like using a Mutex to synchronize threads accessing a shared object...
The first Thread which uses a class method gets access to the object instance. All other threads will hang when they try to do the same, until the current owner thread relinquishes ownership (when its Method call completes).
Posted on 2004-09-05 10:41:37 by Homer
ah yes , a mutex is more suited for this operation.
although semaphore has +- the same idea only it counts while mutex is signaled on/off
Posted on 2004-09-05 16:22:58 by wizzra