race condition on STL vector

James Smith <[email protected]> Mon, 3 Dec 2007 15:34:46 -0800 (PST)
Newsgroups gmane.comp.programming.cppug
Message-ID <[email protected]>
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


       
---------------------------------
Get easy, one-click access to your favorites.  Make Yahoo! your homepage.

[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/cppug/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/cppug/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/