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

Author Topic: Threads inside classes  (Read 3695 times)

0 Members and 1 Guest are viewing this topic.

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
Threads inside classes
« on: December 10, 2011, 06:04:15 pm »
Im trying to integrate a thread into the image loading class, but im getting errors
using this code

Code: [Select]


class TextureResourceManager
{void LoadFiles();
    sf::Thread imgThread;
};

TextureResourceManager::TextureResourceManager():
imgThread(&TextureResourceManager::LoadFiles)
{

}


gives me:
Quote

||=== Agame, Debug ===|
/usr/local/include/SFML/System/Thread.inl||In member function ‘void sf::priv::ThreadFunctor<T>::Run() [with T = void (TextureResourceManager::*)()]’:|
/home/richy/codeblocks/Agame/src/TextureResourceManager.cpp:73|1|instantiated from here|
/usr/local/include/SFML/System/Thread.inl|39|error: must use ‘.*’ or ‘->*’ to call pointer-to-member function in ‘((sf::priv::ThreadFunctor<void (TextureResourceManager::*)()>*)this)->sf::priv::ThreadFunctor<void (TextureResourceManager::*)()>::myFunctor (...)’, e.g. ‘(... ->* ((sf::priv::ThreadFunctor<void (TextureResourceManager::*)()>*)this)->sf::priv::ThreadFunctor<void (TextureResourceManager::*)()>::myFunctor) (...)’|
||=== Build finished: 1 errors, 0 warnings ===|


Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Threads inside classes
« Reply #1 on: December 10, 2011, 09:06:22 pm »
you also have to supply the this pointer to the thread object.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Threads inside classes
« Reply #2 on: December 10, 2011, 11:51:41 pm »
Read the doc!! :evil:
Laurent Gomila - SFML developer

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Threads inside classes
« Reply #3 on: December 13, 2011, 01:02:03 am »
You broke Laurent. Good job.
I use the latest build of SFML2

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Threads inside classes
« Reply #4 on: December 13, 2011, 07:45:55 am »
Quote
You broke Laurent. Good job

You fixed me, thanks :lol:
Laurent Gomila - SFML developer

 

anything