CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2007
    Posts
    21

    Can a thread method call another method in other thread ?

    Hi,


    In a worker thread i have a method Doing and would like to call a method named Move_EntradaToBaseline that to be in other thread ... Especificaly ... the thread where i created the worker thread ...

    I did it ... but i receive a "Violation" message when the method Move_EntradaToBaseline tried to use a single object CString.

    Someone can help me ?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Can a thread method call another method in other thread ?

    What do you mean by "a method ... to be in other thread"?
    Methods belong to classes, not to threads.

    And it could help if you showed us your code.
    Victor Nijegorodov

  3. #3
    Join Date
    Oct 2007
    Posts
    21

    Re: Can a thread method call another method in other thread ?

    Ok, let´s go ...

    I call StartThread() inside constructor of STProfissional.

    The objects composition are:

    My user interface ........... STProfessional ... Do_Start() ... Doing()
    ...................................
    ................................... STFabrica ....... STProducao ... STCelula ... STPacoteFabrica ... Move_()
    .........................................................
    ......................................................... STLogistica ... STProjeto ... STPacoteCliente


    Thread 1 = My user interface
    Thread 2 = Worker thread started inside professional

    From STProfessional i would like to start Move_EntradaToBaseline() in STPacoteFabrica ...

    Inside STFabrica, STProducao, STCelula, STPacoteFAbrica, STLogistica, STProjeto e STPacoteCliente i will make a task files and i put then in a directories that a worker Thread (Thread 2) will get and manage calling function tasks (Or methods) inside the ones ...

    I don´t no is it possible ... but in the process i need this is important ...
    Attached Files Attached Files
    Last edited by SNArruda; April 1st, 2009 at 11:11 AM.

  4. #4
    Join Date
    Oct 2007
    Posts
    21

    Re: Changing the text of last message

    Hi, someone can help with this ?

    The objects composition are:

    My user interface ... STProfissional ... Do_Start() ... Doing()
    .....................
    ..................... STFabrica ....... STProducao ... STCelula ... STPacoteFabrica ... Move_()
    .......................................
    ....................................... STLogistica ... STProjeto ... STPacoteCliente


    Thread 1 = My user interface
    Thread 2 = Worker thread started inside profissional (See code). (Blackground).

    From STProfessional i would like to start Move_EntradaToBaseline() in STPacoteFabrica ...

    My project is basicaly: Inside STFabrica, STProducao, STCelula, STPacoteFAbrica, STLogistica, STProjeto e STPacoteCliente i will make text files containing tasks informations and i put then into directories where a worker Thread (Thread 2) get it and manage it, openig it, reading the tasks informations e calling the apropriated function inside classes STFabrica, STProducao, STCelula, STPacoteFAbrica, STLogistica, STProjeto e STPacoteCliente that efectively do the task.

    My Objects (Or classes if you prefer) are just a Set of CString object containing informations about directories, Names, Caracteristics,etc. Sametimes i use deque<CString> for mantain necessary lists.

    I receive the error when was did my first test that call Move_EntradaToBaseline()...(Thread 1, STPacoteFabrica.cpp) from Doing() (Thread 2, STProfessional.cpp) and the error happen.

    I noted that, when i put a breakpoint in the line where the error heappen, Looking for variables content, they are invalid, with dirty content or invalid pointers ... I don´t now wy this heappen.

    if someone needs i can send the code files ... I realy need help ... the approuch is essencial in my project.

    Sorry by poor english, I´m brasiliam and student for this language ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured