Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 12/22/19 in Posts

  1. aehimself

    Best practices for handling a Stalled thread

    Killing a thread is not a good idea in about 99% of the times 🙂 The best case is that it will leak memory and / or abandon TCP connections. Worst case? It can leave corrupted temporary files around, render your application unusable and requiring a restart or even leave the system in an unbootable state (depending what it is doing which gets forcefully interrupted). Sometimes you have no other option though... There are some REALLY good advices there. Maybe you can launch the image processing in a child process - in regards to the host applications state killing a process can be less painful than a killing a thread.
  2. Is it about the pitfalls of variable captures? The simplest solution to that is to simply divide and conquer. Also - the queuing code you wrote, will only do five scrapings since you never descrement nCount when a task completes, nor do you retry the loop until there are no lines not containing 'done'. procedure TForm1.QueueScraping(I, Q: Integer); Async( procedure begin Memo1.lines.add('I=' + I.ToString() + ' Q=' + Q.ToString()); GetWebContent(I); end ).Await( procedure begin Memo1.lines.add('Done I=' + I.ToString() + ' Q=' + Q.ToString()); end); end; procedure TForm1.BitBtn1Click(Sender: TObject); var I, nCount : Integer; begin I := 0; nCount := 0; for I := 1 to StringGrid.RowCount-1 do begin if StringGrid.Cells[0, I] <> 'done' then begin inc(nCount); if nCount > 5 then Break; QueueScraping(I, nCount) end; end; end;
  3. MariuszJ

    How to get Linux installed?

    As an alternative one can install WINE on linux to be able to open windows apps with it.
×