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

    multithreading and chdir

    Hello,

    Im going through a code, where, it seems the issue is due to the way threading implemented.

    I just know basics of threading

    I am trying to understand the affects of multithreading on chdir, and how can it be made threadsafe.

    May be these hints help me understand the concept and apply in my issue (code is huge, so I am trying to understand the code base first)

    Thanks
    pdk5

  2. #2
    Join Date
    Nov 2018
    Posts
    165

    Re: multithreading and chdir

    Ordinarily, the scope of "chdir" is the whole process. Doing chdir in one thread affects all other threads. It can't be thread safe,
    https://learn.microsoft.com/en-us/cp...?view=msvc-170

    But the link at the bottom of the page suggests you can alter that behaviour.

    TBH, it seems like you need a "currentDir" class which is instanced in each thread. It has a couple of methods
    - set the effective current dir for the current thread
    - resolve a relative path to an absolute path.

  3. #3
    Join Date
    May 2015
    Posts
    540

    Re: multithreading and chdir

    @Salem thankyou very much for the info and help

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