locked
threading general question RRS feed

  • Question

  • statement : i have some tasks that does not require any user interface so i would like to implement them   with threads instead of thru windows

    But they need to habe a message pump

     i have read all of the relevant reference sections and found only declaration that it is possible

    q1)  what must be made at construction/creaton /beginning time ??

    q2) the thread is  considered to have exited when it ends message handler ??

    q3) is there any complete online training /tutorial or so on topic threading ???


    claudio cannella

    Saturday, April 25, 2015 3:10 PM

Answers

  • in the previous version they were three separate applications each with its window , but since they have no user interface the window is unnecessary  and each of it is idle in the operation situation , until oit receives proper messages  then processe them , reads or writes from DB and perform complex computation  as needed , then tables the results and echoes them as  and where neede


    claudio cannella

    That was what I thought when I started reading your questions. You have a wrong idea around threads. 

    Threads are not three processes. It are tasks which are done in one process which can be done asynchronous. 

    What you need are in fact Windows Services.

    https://msdn.microsoft.com/en-us/library/d56de412%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396


    Success
    Cor

    • Marked as answer by opaklaus Wednesday, April 29, 2015 6:25 AM
    Sunday, April 26, 2015 6:49 PM

All replies

  • It is possible to have multiple threads, each which construct a hidden window and use a message pump, but generally speaking, this is a very strong indication of a bad design.

    I strongly urge you to reconsider. Why must each thread have a message pump? Why can't the message pump be handled by the main thread and each thread given non-GUI related work?

    Saturday, April 25, 2015 4:13 PM
  • they are server thread , so they don't have direct users , and they are basically three different tyoe of recalculation which take place depending on data and message and i would like to allocate each of them to a core or socket  and have it process the relevant messages


    claudio cannella

    Sunday, April 26, 2015 4:20 PM
  • they are server thread , so they don't have direct users , and they are basically three different tyoe of recalculation which take place depending on data and message and i would like to allocate each of them to a core or socket  and have it process the relevant messages


    claudio cannella


    You haven't answered my questions.
    Sunday, April 26, 2015 4:35 PM
  • in the previous version they were three separate applications each with its window , but since they have no user interface the window is unnecessary  and each of it is idle in the operation situation , until oit receives proper messages  then processe them , reads or writes from DB and perform complex computation  as needed , then tables the results and echoes them as  and where neede


    claudio cannella

    Sunday, April 26, 2015 6:43 PM
  • in the previous version they were three separate applications each with its window , but since they have no user interface the window is unnecessary  and each of it is idle in the operation situation , until oit receives proper messages  then processe them , reads or writes from DB and perform complex computation  as needed , then tables the results and echoes them as  and where neede


    claudio cannella

    That was what I thought when I started reading your questions. You have a wrong idea around threads. 

    Threads are not three processes. It are tasks which are done in one process which can be done asynchronous. 

    What you need are in fact Windows Services.

    https://msdn.microsoft.com/en-us/library/d56de412%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396


    Success
    Cor

    • Marked as answer by opaklaus Wednesday, April 29, 2015 6:25 AM
    Sunday, April 26, 2015 6:49 PM
  • Hi opaklaus,

    Thank you for posting in the MSDN forum. It seems that it is not the correct forum for this issue, since this forum is to discuss VS IDE. I am moving your question to the moderator forum ("Where is the forum for..?"). The owner of the forum will direct you to a right forum.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, April 28, 2015 5:49 AM
  • Might try over here with a bit more detail.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=csharpgeneral%2Cvbgeneral%2Cvcgeneral&filter=alltypes&sort=lastpostdesc

     

     

     


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

    • Proposed as answer by Mike Laughlin Tuesday, April 28, 2015 12:25 PM
    • Unproposed as answer by opaklaus Wednesday, April 29, 2015 1:18 PM
    Tuesday, April 28, 2015 9:36 AM