News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

catwalk

Started by six_L, February 16, 2021, 04:36:26 AM

Previous topic - Next topic

six_L

the CatWalk example of thread control was written by Ron Thomas long times ago. it was a better example about thread control.
i translated it into x64 Uasm style. and added these "ExitThread,Ret "s function for a thread Exit.
pay attention to:
1. can't use ExitThread in your main thread, Use only own threads which will be exited.
2. monitoring the number of execution threads. 
3. relate to I/O, DLL, MEMORY. "RET" is best. "ExitThread" is better. "TerminateThread" isn't good on unless necessary
Say you, Say me, Say the codes together for ever.

six_L

Say you, Say me, Say the codes together for ever.

six_L

Say you, Say me, Say the codes together for ever.

Biterider

Hi six_L

It works very well. Congrats  :thumbsup:
Nice work!

Biterider

Gunther

Works fine here. The sound is funny.  :thumbsup:

Gunther
You have to know the facts before you can distort them.

TouEnMasm


:thumbsup:

Find a little problem at rebuild.
Quote
      ;SendDlgItemMessageA PROTO hDlg:HWND ,nIDDlgItem:DWORD ,Msg:DWORD ,wParam:WPARAM ,lParam:LPARAM
WPARAM is a qword in X64 this made ThPriority1 (2) qword
Fa is a musical note to play with CL

six_L

hi: Biterider,Gunther,TouEnMasm
thank for your kind words and test.
especially,thank TouEnMasm for finding the error.
invoke SendDlgItemMessage, hdwnd, IDD_LB1, LB_GETCURSEL, 0,0
mov ThPriority1, rax
  invoke SendDlgItemMessage, hdwnd, IDD_LB2, LB_GETCURSEL, 0,0
mov ThPriority2, rax

mov rax,ThPriority1
sub eax, HOFFSET
  invoke SetThreadPriority, hThread1, eax

mov rax,ThPriority2
sub eax, HOFFSET
invoke SetThreadPriority, hThread2, eax
return TRUE

QuoteSetThreadPriority function (processthreadsapi.h)
Sets the priority value for the specified thread. This value, together with the priority class of the thread's process, determines the thread's base priority level.
Syntax
C++

BOOL SetThreadPriority(
  HANDLE hThread,
  int    nPriority
);
Say you, Say me, Say the codes together for ever.

Gunther

Quote from: six_L on February 17, 2021, 05:47:37 AM
hi: Biterider,Gunther,TouEnMasm
thank for your kind words and test.
especially,thank TouEnMasm for finding the error.

you're welcome. 

Good catch TouEnMasm.  :thup:

Gunther
You have to know the facts before you can distort them.

TouEnMasm

The SetThreadPriority parameters are a bit old.https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setthreadpriority
I have changed those old parameters by the new in the upper link.
I have also added some various error messages.
bad parameters could be :
Quote
This value can be specified only if hThread is a handle to the current thread. The function fails
take care of that
Fa is a musical note to play with CL

six_L

hi,TouEnMasm
thank for you'd done on updating. :thumbsup:
There are more functions of thread control:
1. update to 9 levels priority;
2. add to the errors checking;
;----------------------------------------------
the deeper impression is used to translate between the list index and the priority index.
Say you, Say me, Say the codes together for ever.