Re: [AD] Get thread id

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Fri Aug 17, 2012, Thomas Fjellstrom wrote:
> On Fri Aug 17, 2012, Dimitris Zenios wrote:
> > Its not for my program but i think there are cases that you have to be
> > sure that a function is not called from another thread other than the
> > main.Also sanity checks etc.In my opinion i think is something good
> > for the library to supply.If not possible at the moment or difficult
> > to implement in a safe way then it can be skipped.
> 
> Well generally you just don't call functions from multiple threads if they
> shouldn't be called. If you do need/want to call the same function from
> multiple threads, the code needs to be fully reentrant. Generally thats
> done with locks/mutexes, or just not depending on global state or having
> any race conditions (writing from two separate threads? reading from one
> writing in the other?). (or fancy lockless algorithms)

Derp moment. reentrant != thread safe. You want your code to be thread safe.

> > On Sat, Aug 18, 2012 at 2:57 AM, Peter Wang <novalazy@xxxxxxxxxx> wrote:
> > > On Sat, 18 Aug 2012 02:43:06 +0300, Dimitris Zenios
> 
> <dimitris.zenios@xxxxxxxxxx> wrote:
> > >> >From my previous email. get thread id would be an easy way to check
> > >> >if
> > >> 
> > >> the function was called from the main thread or not.
> > > 
> > > But why is your program designed like that?
> > > 
> > > Peter
> > > 
> > > -----------------------------------------------------------------------
> > > -- ----- Live Security Virtual Conference
> > > Exclusive live event will cover all the ways today's security and
> > > threat landscape has changed and how IT managers can respond.
> > > Discussions will include endpoint security, mobile security and the
> > > latest in malware threats.
> > > http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ --
> > > https://lists.sourceforge.net/lists/listinfo/alleg-developers
> > 
> > -------------------------------------------------------------------------
> > -- --- Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's security and
> > threat landscape has changed and how IT managers can respond. Discussions
> > will include endpoint security, mobile security and the latest in malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


-- 
Thomas Fjellstrom
tfjellstrom@xxxxxxxxxx




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/