Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Replicating an instance in a multi-threaded app

Replicating an instance in a multi-threaded app

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 0 Offline
    0 Offline
    0v3rloader
    wrote on last edited by
    #1

    Hello, How do I do about making an app replicate itself whenever a particular event occurs? The application I have in hand is a multi-threaded one, which, at some point in time, has to create a new instance of itself dynamically and automatically, thereby replicating itself, with no user input whatsoever. Can someone shed some light on the correct way to do this? Thanks a lot.

    G 1 Reply Last reply
    0
    • 0 0v3rloader

      Hello, How do I do about making an app replicate itself whenever a particular event occurs? The application I have in hand is a multi-threaded one, which, at some point in time, has to create a new instance of itself dynamically and automatically, thereby replicating itself, with no user input whatsoever. Can someone shed some light on the correct way to do this? Thanks a lot.

      G Offline
      G Offline
      Gary R Wheeler
      wrote on last edited by
      #2

      That depends on what you mean by 'an app replicate itself'. If you mean having a second process running the same code, in the same state, then you need to use CreateProcess() to start a second instance of your application, and pass sufficient information to the second instance for it to initialize itself to the same condition as the original. This will include information that lets you start an equivalent set of threads. This information could be passed in a file on the command line, or through some inter-process communication mechanism. If you're looking for an API function like 'CreateDuplicateProcess()', I'm afraid you're out of luck.


      Software Zen: delete this;

      0 1 Reply Last reply
      0
      • G Gary R Wheeler

        That depends on what you mean by 'an app replicate itself'. If you mean having a second process running the same code, in the same state, then you need to use CreateProcess() to start a second instance of your application, and pass sufficient information to the second instance for it to initialize itself to the same condition as the original. This will include information that lets you start an equivalent set of threads. This information could be passed in a file on the command line, or through some inter-process communication mechanism. If you're looking for an API function like 'CreateDuplicateProcess()', I'm afraid you're out of luck.


        Software Zen: delete this;

        0 Offline
        0 Offline
        0v3rloader
        wrote on last edited by
        #3

        Thanks for the tip, Gary. Will take a look at CreateProcess and see if it allows me to accomplish what I need to. David

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups