Results 1 to 6 of 6

Thread: Multi-Threaded Runtime (not Language)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    New Zealand
    Posts
    1,575

    Lightbulb Multi-Threaded Runtime (not Language)

    Hi

    These has been multiple threads floating around for a number of years on multi-threading DataFlex, but sadly it boils down to:
    "DataFlex was not designed as a thread-safe language and implementing multi-threaded features would be a large exercise"

    That's fine - having
    multi-threaded features within the language might be a big ask for now but what about the (C/C++) runtime ?
    If the runtime (vdfvmxx.dll) had to ability to spawn and wait for threads, it would be a big big big improvement.


    Here's an example of what I'm talking about:

    Procedure Refresh (entry_display / entry_clear)

    Currently, when a request_find/clear is performed the following happens (if successful) in **runtime**:

    Code:
        OnNewCurrentRecord fired on the entire DD structure
        ForEach Data_Set_User_Interface
            Send Refresh notifyMode
        Loop
    This can be really slow on large views with 100-300 UI objects - to a point you can see each value being updated as the refresh is done sequentially.

    Now, if the above could be re-coded using the following logic (pseudo code)

    Code:
     
    
      OnNewCurrentRecord fired on the entire DD structure
        
      ForEach Data_Set_User_Interface
        // c pseudo code - spawn new thread to refresh UI objects
        hThread =  _beginThreadEx (,,Refresh, *notifyMode,  0, &threadId);
      Loop
        
      // Wait for all the threads to complete
      // hThreads = array of hThread handles
    
      While ( SizeofArray(hThreads) )
        iActive = WaitForSingleObject(hThreads[i],0) 
        if (iActive=0) // WAIT_OBJECT_0
          CloseHandle(hThreads[i]);
          RemoveFromArray();
        End
      Loop



    This will definitely provide an increased performance and better UX.

    I'm sure there are other areas within the runtime where similar improvements could be implemented without the need to make the entire runtime or language multi-threaded.

    I hope this makes sense.

    Thanks.
    Last edited by raveens; 8-Nov-2020 at 08:45 PM. Reason: simplified pseudo code
    Regards,
    Raveen Sundram

    Software Development Manager
    Excellent Software Ltd
    Auckland, New Zealand
    www.xls.co.nz

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •