LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-20-2005, 11:08 AM   #1
Jeon, Chang-Min
LQ Newbie
 
Registered: Jul 2005
Location: South Korea
Posts: 9

Rep: Reputation: 0
I want to use SDL_CreateThread in C++


function prototype something like this.

SDL_Thread *SDL_CreateThread(int (*fn)(void *), void *data);

But I don't know how to throw argument of SDL_CreateThread func.

I want to create thread of run func.

Example.

Class AAA{

public:
int run();

void create();
};


int AAA::run()
{
while(1)
{
Do something
}
}

void AAA::create()
{
SDL_Thread* thread = SDL_CreateThread(??????, NULL);

}
 
Old 07-20-2005, 01:10 PM   #2
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
This belongs in Programming, unless you want more people to see it or something.
Anyway, you need to create a function that looks kinda like
int timerFunction(void *data) {
// do stuff
}
Then call
SDL_Thread *thread=SDL_CreateThread(&timerFunction, (void *)data)

You should probably google "c++ function pointers" to get a proper explanation
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration