Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [A4/A5] How thread safe is Allegro?

This thread is locked; no one can reply to it. rss feed Print
[A4/A5] How thread safe is Allegro?
Chris Katko
Member #1,881
January 2002
avatar

Both Allegro 4, and Allegro 5? How thread safe are we talking about? Can I blit to multiple bitmaps at the same time? Can I load files at the same time?

What happens when I blit to different sections of the same bitmap? (Mutex locked, I assume?)

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Gideon Weems
Member #3,925
October 2003

There's actually a really good article on this. It's a shame the wiki doesn't get the attention it deserves.

Thomas Fjellstrom
Member #476
June 2000
avatar

I don't think A4 gives much thought to user threads. Some parts of the implementations use threads behind the scenes, but even then its a bit sketchy from what I remember. Locking is totally up to you.

As for A5, it was designed to be thread safe. Much state is stored in thread local variables. You can draw with hw in two different threads if you have two separate contexts set up. Otherwise you're stuck to a single thread drawing on a context at a time, with other threads using software.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

SiegeLord
Member #7,827
October 2006
avatar

The nicest thing you can say about this is that Allegro5 aspires to be thread safe. It's straightforward to find parts that can race each other, however. I don't think many of those things can or should be fixed, but rather a better approach is to examine the common use cases and make sure they don't have thread-safety issues.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Go to: