• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 

Some Thread related questions ...

Started by moelski, April 05, 2010, 04:50:51 am

Previous topic - Next topic

moelski

Hi Roman,

we just have started working on a new enhanced version of our software. One feature is the complete isolation of the receiving of data and the Main Thread.

But I got some questions about the nrComm Threading ...

1) Could you explain "UseMainThread" a little bit more detailed? Is the complete receiving / sending of data done in the mainthread? Or is there an additional thread, too?
2) Is there any way to set the Thread Priority to a higher one - like THREAD_PRIORITY_ABOVE_NORMAL ? I want to ensure that the data is received even if the main Thread is completely blocked.
3) The dataprocessing runs also in the nrComm Thread ?
4) Is  there any chance to get the ProcessID of the Thread? We use a lot of threads and sometimes it´s good to know which thread ID is used ...

Greetz Dominik

Roman Novgorodov

Hello

Please see answers below:

Quote
1) Could you explain "UseMainThread" a little bit more detailed? Is the complete receiving / sending of data done in the mainthread? Or is there an additional thread, too?


nrComm has standalone thread for monitoring incoming data. If UseMainThread is false, component uses this internal thread for update assigned controls and call event handlers. If you need synchronization with main application thread, set this property in True and all handlers will be call from main thread.

Quote
2) Is there any way to set the Thread Priority to a higher one - like THREAD_PRIORITY_ABOVE_NORMAL ? I want to ensure that the data is received even if the main Thread is completely blocked.


Current version does not have such functionality.
Please note that this feature is not too necessary:
a) System driver of serial port places incoming data into internal buffer and nrcomm reads this data.
b) If you set UseMainThread in false, internal nrComm thread reads all data independently on main thread, because most modern CPUs are multicore :-)

Quote3) The dataprocessing runs also in the nrComm Thread ?

If UseMainThread is false, DataProcessor runs in internal nrComm thread.

Quote4) Is  there any chance to get the ProcessID of the Thread? We use a lot of threads and sometimes it´s good to know which thread ID is used ...


You can use ordinary system calls GetCurrentProcessId() and  GetCurrentThreadId()

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.