Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple processes are multi-threaded in parallel? #1242

Open
hypnosis01 opened this issue Feb 26, 2024 · 1 comment
Open

Multiple processes are multi-threaded in parallel? #1242

hypnosis01 opened this issue Feb 26, 2024 · 1 comment

Comments

@hypnosis01
Copy link

hypnosis01 commented Feb 26, 2024

public class AspSample : StepBody
{
private static readonly Logger log = LogManager.GetCurrentClassLogger();
private static volatile int _counter = 0;

public AspSample()
{
    log.Debug("AspSample init ...");
}

public override ExecutionResult Run(IStepExecutionContext context)
{
    if (_counter % 2 == 0) 
    {
        Thread.Sleep(2000);
    }
    log.Debug($"StepBody: {nameof(AspSample)}");
    AspSample._counter++;
    return ExecutionResult.Next();
}

}

var host = serviceProvider.GetService();
host.StartWorkflow("PTWorkFlow", 1, null);
host.StartWorkflow("PTWorkFlow", 1, null);
host.StartWorkflow("PTWorkFlow", 1, null);
host.StartWorkflow("PTWorkFlow", 1, null);

Multiple process implementations were initiated。

image

Multiple processes are executed serially.......

@hypnosis01
Copy link
Author

How do I make each process instance execute in a separate thread?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant