Parallel Threading vs Serial Threading in Mechanical ACT

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 442
250 Likes Solution Developer Community of Practice Member Ansys Employee First Anniversary
✭✭✭✭

Parallel Threading vs Serial Threading in Mechanical ACT

Comments

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 442
    250 Likes Solution Developer Community of Practice Member Ansys Employee First Anniversary
    ✭✭✭✭
    edited October 2023

    Parallel Threading: The control moves over to the rest of the code, while part of the code is executed in a parallel thread.

    Please note the "," after the 2nd argument is crucial.

    Example:

    import threading
    msg_string = "Test String"
    
    def show_info(message):
        MessageBox.Show(message)
    
    thread = threading.Thread(target=show_info, args=(msg_string,))
    thread.start()
    

    Serial Threading: The control pauses till the user clicks OK in the MessageBox but the set of commands is executed in a separate thread.

    Example:

    msg_string = "Test String"
    
    def show_info(message):
        MessageBox.Show(message)
    
    ExtAPI.Application.InvokeUIThread(show_info, msg_string)