Top.Mail.Ru Yandeks.Metrika
Forum: "Main";
Current archive: 2002.04.01;
Download: [xml.tar.bz2];


TThread Find similar branches

lipskiy   (2002-03-20 20:32) [0]

Why is it impossible to specify a procedure with parameters with the Synchronize parameter? This is very inconvenient - you need to work through global variables. Why? Is it still possible to make a call with parameters?

Юрий Зотов   (2002-03-20 20:44) [1]

Because it’s done so. And global variables are completely optional. In a help there is an example.

procedure TMyThread.MyMethod;
AnyMetod (AnyParamList); // Here it is - any parameter list

procedure TMyThread.Execute;
Synchronize (MyMethod);

lipskiy   (2002-03-20 20:50) [2]

Ahem ... This is understandable.
But here, in my case, everything looks something like this.
Execute executes fairly long, unbranched and non-looping code. Just a sequence of operations. Between these operations, I need to print the result on the main form. Naturally, these intermediate results occur only within Execute.
So what to do in this case?

Набережных С.   (2002-03-20 21:31) [3]

Dynamically allocate memory for the structure or variables and send the pointer through SendMessage, PostMessage or Synchronize.
Another option is a buffer with synchronization. There are other options, such as COM.

vuk   (2002-03-20 21:48) [4]

I don’t know who how, but I would go a completely different way. True, it turns out a little more complicated.
All parameters that a form needs to display the result are packed into a structure (record or object). Then a list (TThreadList) is created, which serves as a “buffer” and into which the thread adds the results of its work. Also, the stream has a Handle of the form to which it sends a message as soon as an item is added to the list. The form, having received the message, selects the elements from the list, displays them and then deletes them.

lipskiy   (2002-03-20 21:53) [5]

Damn, it's good to be smart ...
I don’t understand all this ... (for now)
Well, okay, thanks, and I'll figure it out.
Just my level below your suggestions.

Набережных С.   (2002-03-20 21:55) [6]

> vuk © (20.03.02 21: 48)

"Another way" - in what sense?
See > Another option is a buffer with synchronization

vuk   (2002-03-20 21:59) [7]

to Naberezhnye S .:
> "Another way" -in what sense?
I’m sorry, I overlooked. : o (
Well, nobody got worse from this. : o)

Набережных С.   (2002-03-20 22:05) [8]

I also apologize - I wrote in vain.

Pages: 1 whole branch

Forum: "Main";
Current archive: 2002.04.01;
Download: [xml.tar.bz2];


Memory: 0.56 MB
Time: 0.02 c
2002-03-20 21:46
TThread: How to create your own signaling object?

2002-03-07 12:20
Current value of entry in ADO?

2002-03-22 09:16
Current Windows language

2002-01-20 01:39
Very simple question!

2002-03-19 15:30
How to set the cursor at the end of the text line?

afrikaans albanian Arabic armenian azerbaijani basque belarusian bulgarian catalan Chinese (Simplified) Chinese (Traditional) croatian Czech danish Dutch English estonian filipino finnish French
galician georgian German greek haitian Creole hebrew Hindi hungarian icelandic indonesian Irish italian Japanese Korean latvian lithuanian macedonian malay maltese norwegian
persian polish portuguese Romanian russian serbian slovak Slovenian Spanish swahili Swedish thai turkish Ukrainian urdu vietnamese welsh yiddish bengali bosnian
cebuano Esperanto gujarati hausa hmong igbo javanese kannada Khmer lao latin maori marathi mongolian nepali punjabi somali tamil telugu yoruba
English French German Italian Portuguese Russian Spanish