CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2002
    Posts
    372

    synchronization question

    hi guys,

    i cant made up my mind about this.
    if i have an stl vector with n elements that will never change its content,
    and there are two threads accessing this vector for read purposes only,
    do i need to synchronize this object ?

    thanks

  2. #2
    Join Date
    Apr 2003
    Posts
    1,755

    Re: synchronization question

    I don't think you need synchronization to share the vector in read mode. Just make sure that only the vector is shared, not the iterators.

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: synchronization question

    No synchronization is required if all threads are read-only.

    However, make sure the vector is completely populated prior to starting the threads.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured