Re: [AD] public thread API

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


On Wed, 2008-08-06 at 11:04 +1000, Peter Wang wrote:
> > word order?
> 
> As in, al_create_thread, al_lock_mutex, al_broadcast_cond.  Which looks
> fine actually.  We should do it for consistency.
> 

Ah, of course, you mean the function names :) And yes, I agree, let's
stick to the al_verb_noun as suggested in Grzegorz's document from the
A5 files.

> > One thing I'm wondering now, if we use the malloc/free way instead of
> > preallocation, should we provide a separate
> > al_thread_create/al_thread_destroy to do the allocation, and rename the
> > current al_thead_create to al_thread_start?
> 
> Yes, I think this would be quite useful.
> 
> Taking it a bit further, al_create_thread could not just allocate the
> space for the thread handle, but call pthread_create.  But we would not
> actually execute the user's thread function until al_start_thread.
> I believe this is useful for cases like:
> 
>     T = al_create_thread(thread_func);
>     do further initialisation, using T
>     al_start_thread(T);
> 
> Not sure how common it is.
> 

I was thinking about creating the threads first, then you could run them
multiple times, then destroy them. (So would not call pthread_create I
think.)

-- 
Elias Pschernig <elias@xxxxxxxxxx>





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