[Balug-Talk] race condition on STL vector
James Smith
engjames2640 at yahoo.com
Mon Dec 3 13:09:43 PST 2007
hi,
I would like to know if this is a race condition on the STL vector class. The code is below.
class Buffers {
public:
Buffers() : sig_buff(NUM_BUFFERS) { }
~Buffers(){ }
vector<buff>::iterator operator[](int dex)
{
vector<buff>::iterator it = (pthread_mutex_lock(&sig_buff[dex].mutex)?it:sig_buff.begin()+dex);
return it;
}
void release_buffer(int dex)
{
pthread_mutex_unlock(&sig_buff[dex].mutex);
}
private:
vector<buff> sig_buff;
};
Thanks,
Jim Smith
Thanks,
Jim Smith
Software Developer
Tel. 215.833.6973
---------------------------------
Get easy, one-click access to your favorites. Make Yahoo! your homepage.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.balug.org/pipermail/balug-talk-balug.org/attachments/20071203/8bd51e1c/attachment.htm
More information about the Balug-Talk
mailing list