Jump to content

Nasreddine

Members
  • Content Count

    20
  • Joined

  • Last visited

Community Reputation

2 Neutral

Technical Information

  • Delphi-Version
    Delphi 10.4 Sydney

Recent Profile Visitors

2071 profile views
  1. @Remy Lebeau thank you very much for the advice, I will definitely write a better implementation now then the one I had before. @PeterBelow thank you very much for sharing the part where you process the pending messages, it will help me a lot to make the finale idea come true. Again guys thank you very much for the help.
  2. @FredS @Remy Lebeau Thank you very much guys, I'm refactoring my code now to use MsgWaitForMultipleObjects and see the difference Remy Do you have an example how to pump the message queue in this case? I would like to compare when I'm done.
  3. @Remy Lebeau In that case wouldn't that be the same as my Idea above? block current execution while pumping the message queue, and thank you by the way I did not know you can set it up that way, I always thought it was meant to wait for events.
  4. @FredS What you said is true and I already do it, what I want is to block the current execution until the thread finishes but keep the app responsive. MsgWaitForMultipleObjects will freeze the app waiting for the thread to finish.
  5. I have the following style of using Async Await in delphi Async( procedure(aArgs: TnArgs) begin // long time work on worker thread using TThread end). SetReportInThreadException(False). Await( procedure(aArgs: TnArgs) begin // result executed on main thread using TThread.Synchronize(); end ); this works wonderfully for fire and forget pattern, but that means any code after this Async/Await combo will be executed without waiting for the Await part, What I want to do now is refactor my Async/Await code and use function TApplication.ProcessMessage(var Msg: TMsg): Boolean; to block the current execution until I receive a message indicating that the Await part was executed and it is safe to continue the execution of the rest of my code on the main again example of A procedure TAwaiter.AwaitBlocked(aProcArg: TProc<TnArgs>; out AAwaiter: IAwaiter); begin FnThread := TnThread.SetupAsync(FAsyncArg, FProgress, aProcArg, FReportInThreadException); FnThread.Start; AAwaiter := Self; while not TnApplication(Application).nProcessMessage(FTaskID) in [WM_QUIT, WM_MYThreadTaskEndedMsg] do {loop}; end; AwaitBlocked method will create the thread and start it and then that thread will post a message when done. Now to the question, based on your experience, Do you see anything wrong with the design? Keep in mind the following is all taken into consideration: - The user clicks again on the button. - any other special handling that will free the resources needed for the blocked instruction after the await. - Exceptions handling. the end result code Async( procedure(aArgs: TnArgs) begin // long time work on worker thread using TThread end). SetReportInThreadException(False). AwaitBlocked( procedure(aArgs: TnArgs) begin // result executed on main thread using TThread.Synchronize(); end ); // other code to execute that is dependent on what happens in the code executed in the await part, or needs to wait for that part to be done
  6. Nasreddine

    Delphi and the new Apple M1 CPU

    @Hans♫ it was permission errors but the new 11.1.2 BigSur update fixed them for the M1 target. this is a confirmed guess I think, we asked them on the latest webinar and they said that they know about the problem but they can not give any time frame about the solution.
  7. Nasreddine

    Embarcadero Toaster - Notification Window Caption in Win10

    I have created an issue in quality portal, I hope you do not mind the picture. https://quality.embarcadero.com/browse/RSP-32375
  8. Nasreddine

    Embarcadero Toaster - Notification Window Caption in Win10

    It is still there just in a new refactored structure but the same logic.
  9. Nasreddine

    Embarcadero Toaster - Notification Window Caption in Win10

    By the way It was really funny to see people trying to know what it is.
  10. Nasreddine

    Delphi and the new Apple M1 CPU

    the first time I could not see the area where to click to add a vote, but after couple of hours I went back to see the description and I was able to vote. I really hope they fix it fast, I purchased an M1 just to test the project I'm working on and now I can't debug. I'm also facing issues where the app works great on an intel machine but fails on an M1 one. we have to wait at least 8 months for 10.5 to be able to target arm.
  11. Nasreddine

    Delphi and the new Apple M1 CPU

    I added a comment too, They removed voting????
  12. Nasreddine

    Delphi and the new Apple M1 CPU

    did you manage to solve it? I have M1 as well and with same error
  13. Nasreddine

    Delphi iOS Metal Api Comparison (Video)

    Cool, I really like the animations, what game engin are you using for the characters?
  14. Nasreddine

    function reference feature for Delphi source code

    @dummzeuch thank you for the response, and thank you for detailing what is missing, the cod in the picture is c# not c++. it does not always work and sometimes it throws exceptions. RAD Studio is way behind in productivity tools, it always takes me twice the time to do the same job in vs. this can be done and I think there are many examples of how one can do it. so this is not the show stopper I guess. this is the main problem I guess, but I think it can be solved the same way by the code responsible of the feature "go to definition" (initially as proof of concept) so Grep searches for all references (with whole word condition) and then see if the "go to definition" code will lead back to the line in the current file we are doing the search for. do you think an approach like this would work?
  15. is it possible to tweek the GExpert tool to search in the background for all function/procedure references and paint the result count on the source editor window like the attached picture? the Grep search feature now works great and it already has the functionality to jump to other files. so my proposition is to make the Grep search for all functions/procedure references that are found on the project path and lib path and the standard paths. then paint the count like visual studio is doing. and when the user clicks on the count the grep window is shown, and in future iteration it can be enhanced to show the implementation where the reference directly. This is just an idea that I had after spending an hour to locate all the references of a function in a large project.
×