[SDL] What are threads allowed to do?
albert at users.sf.net
Thu Jan 20 16:58:11 PST 2005
On Thu, 2005-01-20 at 19:37, Bob Ippolito wrote:
> On Jan 20, 2005, at 19:08, Albert Cahalan wrote:
> > Looking here:
> > http://sdldoc.csn.ul.ie/thread.php
> > I find these bits of advice:
> > 1. Don't use any library functions in separate threads
> > 2. Lock global variables which may be accessed by multiple threads
> > Cool. Taken literally, this means that a thread may
> > only burn CPU time. It can not access global variables,
> > because locking them would require a library function. The
> > thread can not exit; that would require a library function..
> > What's the real story?
> The thread related functions required for synchronization are of course
> thread-safe. Those are guidelines, not strict rules.
I figured as much, but...
Mere guidelines alone don't make for solid software. Am I to assume
that all other SDL functions are unsafe? The same for C library stuff
on the various supported platforms? If this is the case, then threads
are quite useless.
I tried using threads, hit memory corruption problems, and...
well, what am I to do? I can not even determine if my own code
is correct if thread-safety of various library functions is
undocumented. Really, it is completely unsafe to use threads
without documentation. I went with the optimistic approach, but
that obviously isn't right. Pessimism suggests that all functions
are unsafe, and thus SDL threads are pointless. If reality is
somewhere in-between but undocumented, I'll have to go with the
More information about the SDL