Académique Documents
Professionnel Documents
Culture Documents
programming.
Threads
BOTNARI NICOLAE
FAF-141
UTM
Threads
A Thread is an independent stream
of instructions that can be schedule
to run as such by the OS.
Think of a thread as a procedure
that runs independently from its
main program.
Multi-threaded programs are where
several procedures are able to be
scheduled to run simultaneously
and/or independently by the OS.
A Thread exists within a process and
uses the process resources.
Pthread Management
Creating Threads
Pthread Management
Terminating Threads
Terminating Threads
Pthread Example
void enemyy(void*){
Texture tileSet, moveplatform, megaman, fang;
tileSet.loadFromFile("files/mario.png");
Level lvl;
lvl.LoadFromFile("plat_test.tmx");
AnimationManager anim3;
anim3.create("move",tileSet,0,0,16,16,2,0.002,18);
anim3.create("dead",tileSet,58,0,16,16,1,0);
std::list<Entity*> entities;
std::list<Entity*>::iterator it;
std::vector<Object> e = lvl.GetObjects("enemy");
pthread_join(pth, NULL);
Why SFML ?
I.
System (VectorandUnicodestringclasses,
portablethreadingand timer facilities)
II.
Window(Windowandinput devicemanagement
including support forjoysticks,OpenGLcontext
management)
III. Graphics(Hardware-accelerated2D
graphics
includingsprites,polygonsand text rendering)
IV.
Audio(Hardware-acceleratedspatialisedaudio
playback and recording)
V.
Network(TCPandUDPsockets, data
encapsulation facilities,HTTPandFTPclasses)