Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
3
Erster Beitrag:
vor 1 Jahr, 3 Monaten
Letzter Beitrag:
vor 1 Jahr, 3 Monaten
Beteiligte Autoren:
ccc2

[wm21 - android] question about ExecuteMainThread()

Startbeitrag von ccc2 am 08.11.2016 04:22

Hi,

can anyone explain in detail the flow of process of ExecuteMainThread() ?

help explain "Triggers the execution of a procedure by the main thread of the application"

I don't understand . when is the execution start ?

for example if I have 5 looper in a windows , each looper create one thread to retrieve data and fill into the looper . in each thread i use ExecuteMainThread(add_row) to add to looper.

This is my assumption what will happen:
since I have 5 thread running with mean there will be 5 request "Triggers the execution" to main thread. this cause main thread to execute one request at a time.
If main thread is busy then the 5 request "Triggers the execution" will have to wait until main thread is free

am I right ?

Antworten:

my suspicious come because of LooperAddInProgress (Function) example

///////////////////////////// EXAMPLE ////////////////////////////////////////////////////////////////////////////
// [Adding additional elements] process
LooperAddInProgress(LOOP_MyLooper, True)
ThreadExecute(myProcGetAdditionalResult)


// -----
PROCEDURE myProcGetAdditionalResult()

QRY_MoreData.MinID = LOOP_MyLooper[LOOP_MyLooper..Occurrence].ID
HExecuteQuery(QRY_MoreData) // Run a long query
HReadFirst(QRY_MoreData)
WHILE NOT HOut(QRY_MoreData)
// Adds elements to the looper from the main thread to modify the GUI
// AddIntoMainThead will use the WLanguage ExecuteMainThread function
AddIntoMainThead(LOOP_MyLooper, QRY_MoreData.Title, ...
QRY_MoreData.Photo, QRY_MoreData,ArticleID)
HReadNext(QRY_MoreData)
END

LooperAddInProgress(LOOP_MyLooper, False)

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

what the different if I put the whole code of myProcGetAdditionalResult in ExecuteMainThread() calling procedure


PROCEDURE myProcGetAdditionalResult()
ExecuteMainThread(Add_Row)


PROCEDURE Add_Row()
QRY_MoreData.MinID = LOOP_MyLooper[LOOP_MyLooper..Occurrence].ID
HExecuteQuery(QRY_MoreData) // Run a long query
HReadFirst(QRY_MoreData)

WHILE NOT HOut(QRY_MoreData)
LopperAddLine(LOOP_MyLooper, QRY_MoreData.Title, QRY_MoreData.Photo, QRY_MoreData,ArticleID)
HReadNext(QRY_MoreData)
END

LooperAddInProgress(LOOP_MyLooper, False)

von ccc2 - am 08.11.2016 04:31
my suspicious come because of LooperAddInProgress (Function) example

///////////////////////////// EXAMPLE ////////////////////////////////////////////////////////////////////////////
// [Adding additional elements] process
LooperAddInProgress(LOOP_MyLooper, True)
ThreadExecute(myProcGetAdditionalResult)


// -----
PROCEDURE myProcGetAdditionalResult()

QRY_MoreData.MinID = LOOP_MyLooper[LOOP_MyLooper..Occurrence].ID
HExecuteQuery(QRY_MoreData) // Run a long query
HReadFirst(QRY_MoreData)
WHILE NOT HOut(QRY_MoreData)
// Adds elements to the looper from the main thread to modify the GUI
// AddIntoMainThead will use the WLanguage ExecuteMainThread function
AddIntoMainThead(LOOP_MyLooper, QRY_MoreData.Title, ...
QRY_MoreData.Photo, QRY_MoreData,ArticleID)
HReadNext(QRY_MoreData)
END

LooperAddInProgress(LOOP_MyLooper, False)

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

what the different if I put the whole code of myProcGetAdditionalResult into ExecuteMainThread() calling procedure


PROCEDURE myProcGetAdditionalResult()
ExecuteMainThread(Add_Row)
LooperAddInProgress(LOOP_MyLooper, False)


PROCEDURE Add_Row()
QRY_MoreData.MinID = LOOP_MyLooper[LOOP_MyLooper..Occurrence].ID
HExecuteQuery(QRY_MoreData) // Run a long query
HReadFirst(QRY_MoreData)

WHILE NOT HOut(QRY_MoreData)
LopperAddLine(LOOP_MyLooper, QRY_MoreData.Title, QRY_MoreData.Photo, QRY_MoreData,ArticleID)
HReadNext(QRY_MoreData)
END


will this make different in Performance ?

von ccc2 - am 08.11.2016 04:33
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.