Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Thread issues  (Read 3613 times)

0 Members and 1 Guest are viewing this topic.

player931402

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Thread issues
« on: March 19, 2012, 10:39:30 pm »
Hi guys!

I need to have in "par" my game with the Listen socket on my client.

Now, i'll try to do somwhat like this but doesn't work!

Someone can help me?

Code: [Select]
void ThreadFun(void *UserData)
{
Network->work();
}

int main()
{
Game* game= new Game();

sf::Thread Threads(&ThreadFun);

Game->work();

    return EXIT_SUCCESS;
}



Info -> the thread starts much after commencing the game
( Before i need to send/recv singles datas in another methods. )
SFML 2.0 , vc++2010

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Thread issues
« Reply #1 on: March 20, 2012, 07:53:35 am »
And what's your problem?
Laurent Gomila - SFML developer

player931402

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Thread issues
« Reply #2 on: March 20, 2012, 11:49:13 am »
Quote from: "Laurent"
And what's your problem?



soz:

Code: [Select]
1>------ Inizio compilazione: Progetto: Schizzo, Configurazione: Release Win32 ------
1>  main.cpp
1>D:\sfml2\include\SFML/System/Thread.inl(39): error C2198: 'void (__cdecl *)(void *)': argomenti insufficienti per una chiamata
1>          D:\sfml2\include\SFML/System/Thread.inl(39): durante la compilazione della classe modello, funzione membro 'void sf::priv::ThreadFunctor<T>::Run(void)'
1>          with
1>          [
1>              T=void (__cdecl *)(void *)
1>          ]
1>          D:\sfml2\include\SFML/System/Thread.inl(70): vedere il riferimento all'istanza del modello di classe 'sf::priv::ThreadFunctor<T>' in corso di compilazione
1>          with
1>          [
1>              T=void (__cdecl *)(void *)
1>          ]
1>          main.cpp(22): vedere il riferimento all'istanza del modello di funzione 'sf::Thread::Thread<void(__cdecl *)(void *)>(F)' in corso di compilazione
1>          with
1>          [
1>              F=void (__cdecl *)(void *)
1>          ]
========== Compilazione: 0 completate, 1 non riuscite, 0 aggiornate, 0 ignorate ==========

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Thread issues
« Reply #3 on: March 20, 2012, 12:00:35 pm »
Have you read the documentation of sf::Thread? The class has changed in SFML 2, everything's explained in the doc with examples.
Laurent Gomila - SFML developer