CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 1999
    Posts
    10

    CCriticalSection and array elements

    If say, I have an array of CStrings which is being accessed by two threads, is it possible to lock individual elements of that array?

    The idea being not to lock up the entire array.

    If this is possible, could someone post a simple example?

    Many thanks

    DJ


  2. #2
    Join Date
    Jun 1999
    Posts
    16

    Re: CCriticalSection and array elements

    Yes, if you can control how access is gained to the array.
    One way would be to build your own array class and aggregate or privately
    derive from an exisiting array class. Then in your classes [], getElementAt(),
    or whatever method, insert your critical section. It really depends on how fancy you want to get;-)


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