Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying SFML Blueprints
  • Table Of Contents Toc
SFML Blueprints

SFML Blueprints

By : Barbier
3.8 (4)
close
close
SFML Blueprints

SFML Blueprints

3.8 (4)
By: Barbier

Overview of this book

This book is for developers who have knowledge of the basics of the SFML library and its capabilities in 2D game development. Minimal experience with C++ is required.
Table of Contents (10 chapters)
close
close
9
Index

Thread functionality


Now, we will speak about threads. The threads' functionalities are very close to the fork ones, but with some important differences. A thread will create a new stream to your running process. Its starting point is a function that is specified as a parameter. A thread will also be executed in the same context as its parent. The main implication is that the memory is the same, but it's not the only one. If the parent process dies, all its threads will die too.

These two points can be a problem if you don't know how to deal with them. Let's take an example of the concurrent memory access.

Let's say that you have a global variable in your program named var. The main process will then create a thread. This thread will then write into var and at the same time, the main process can write in it too. This will result in an undefined behavior. There are different solutions to avoid this behavior and the common one is to lock the access to this variable with a mutex.

To put it simply...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
SFML Blueprints
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon