none
Setting priority to process while shutdown RRS feed

  • Question

  • Working in C#
    I have three processes Process-A, Process-B and Process-C running in my system startup.

    At the time of system start up, Process-A will start first and then Process-B and then process-C


    When I raise shutdown signal, through system shutdown option,

    Process-A is receiving the signal first and then Process-B and C.

     

    Is there any way set to get the signal for Process-c first instead of Process-A.

     

    To be more specific Process-C should receive the shutdown signal first before all the process running in my system.

    Tuesday, September 8, 2009 10:10 AM

Answers

  • Hmm, that's strange, processes are normally shut down in the reverse order they got started.  Well, you can change it, you'd have to P/Invoke SetProcessShutdownParameters().  Visit pinvoke.net for the required declaration.

    Hans Passant.
    Tuesday, September 8, 2009 10:20 AM
    Moderator

All replies

  • Hmm, that's strange, processes are normally shut down in the reverse order they got started.  Well, you can change it, you'd have to P/Invoke SetProcessShutdownParameters().  Visit pinvoke.net for the required declaration.

    Hans Passant.
    Tuesday, September 8, 2009 10:20 AM
    Moderator
  • instead of startup process make them windows services and set the dependency : Process C depends on Process A & B and Process B depends on Process A.
    Hope this will help.

    because now OS cant stop service A and B without stopping service C. :) (Ideally it should happen for processes also)
    Tuesday, September 8, 2009 11:45 AM
  • Thanks for the suggestion,
    I set the priority for my Process through SetProcessShutdownParameters(0x4FF, 0).
    Its working now. Thank You.
    Wednesday, September 9, 2009 3:59 AM