Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


good uses of multi-threading?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sat Dec 29, 2007 1:27 am    Post subject: good uses of multi-threading? Reply with quote

What are some good uses of multi-threading?
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
DoomsDay
Grandmaster Cheater
Reputation: 0

Joined: 06 Jan 2007
Posts: 768
Location: %HomePath%

PostPosted: Sat Dec 29, 2007 1:35 am    Post subject: Reply with quote

It allows you to do more tasks at the same time.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 474

Joined: 09 May 2003
Posts: 25956
Location: The netherlands

PostPosted: Sat Dec 29, 2007 2:00 am    Post subject: Reply with quote

doing processing in a seperate thread instead of the main thread, allowing a user to start another process at the same time.

also, on multicore cpu's not using multithreading is just wasting at least half of the system's functionality. Put those cores to use.

_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sat Dec 29, 2007 9:56 am    Post subject: Reply with quote

I know what multi-threading is. I stated it wrong. I meant like examples of multi-threading in use.
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
DoomsDay
Grandmaster Cheater
Reputation: 0

Joined: 06 Jan 2007
Posts: 768
Location: %HomePath%

PostPosted: Sat Dec 29, 2007 11:00 am    Post subject: Reply with quote

Progress-bars are good examples . Also: when you create a form - it's a thread.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 474

Joined: 09 May 2003
Posts: 25956
Location: The netherlands

PostPosted: Sat Dec 29, 2007 12:05 pm    Post subject: Reply with quote

actually, a form isn't a thread, it's just event based (there's a main thread that handles messages of all windows and dispatches them to the correct functions and that loop can be called from code using application.processmessages)

anyhow, one example of threads is ce 5.4's new memory scanner.
It creates 2 threads on a dualcore and 4 threads on a quadcore, splits up the region to be scanned between the threads and scans them

Same for ce's pointerscanner, each time it goes through a list of results, and then assigns a result to a idle thread or when all threads are already working wait till one is done and give it the new task.

another use of multithreading would be in games. One thread doing physics, the other thread doing audio, one thread for AI, and another thread the rendering (e.g ut3 uses a lot of threading)

And you can also use it for little things, like ce's color changing on the process button. It's a low priority thread that changes the color continuesly.

_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Dec 29, 2007 3:40 pm    Post subject: Reply with quote

Some articles:

http://www.devarticles.com/c/a/Cplusplus/Multithreading-in-C/
http://www.computersciencelab.com/MultithreadingTut1.htm

Multithreaded OpenGL app:
http://www.codeproject.com/KB/openGL/GLBase.aspx

A lot more examples:
Clicky here...

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sat Dec 29, 2007 4:16 pm    Post subject: Reply with quote

Can someone explain to me a little more of the beginthread API in this code?

Code:

#include <stdio.h>
#include <windows.h>
#include <process.h>         // needed for _beginthread()
 
void  silly( void * );       // function prototype

int main()
{
    // Our program's first thread starts in the main() function.

    printf( "Now in the main() function.\n" );

    // Let's now create our second thread and ask it to start
    // in the silly() function.

    _beginthread( silly, 0, (void*)12 );

    // From here on there are two separate threads executing
    // our one program.

    // This main thread can call the silly() function if it wants to.

    silly( (void*)-5 );

    Sleep( 100 );
}

void  silly( void *arg )
{
    printf( "The silly() function was passed %d\n", (INT_PTR)arg ) ;
}

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Cx
Master Cheater
Reputation: 0

Joined: 27 Jul 2007
Posts: 367

PostPosted: Sat Dec 29, 2007 4:27 pm    Post subject: Reply with quote

http://msdn2.microsoft.com/en-us/library/kdzttdcb(VS.80).aspx
_________________

armed with this small butterfly net
i will face the world alone
& never be lonely.
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sat Dec 29, 2007 4:31 pm    Post subject: Reply with quote

Quote:

_beginthread( silly, 0, (void*)12 );


Quote:

silly( (void*)-5 );


It's really the bolded parts I don't get.

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Dark Byte
Site Admin
Reputation: 474

Joined: 09 May 2003
Posts: 25956
Location: The netherlands

PostPosted: Sat Dec 29, 2007 7:35 pm    Post subject: Reply with quote

it converts the value of 12 and -5 to a pointertype so the compiler won't complain, since the prototype of silly expects a pointer instead of a integer
_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites