[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> On Fri, Aug 17, 2012 at 4:07 PM, Dimitris Zenios <dimitris.zenios@xxxxxxxxxx> wrote:
> > What if we change (uint32_t)pthread_self to (uint32_t)getpid();
That would be completely wrong.
On Fri, 17 Aug 2012 16:27:49 +0300, Dimitris Zenios <dimitris.zenios@xxxxxxxxxx> wrote:
> SDL assumes is safe to cast pthread_self to a number.
And earlier versions cast to Uint32..
> Maybe we should change uint32_t to uint64_t
That would work for platforms where pthread_t is a pointer
(assuming pointers fit in 64-bits), but not where pthread_t is a struct.
pthreads-win32 is one of the latter[1], as well as some obscure Unixes.
Who knows if some new C library will take up that option in the standard.
The solution would be to adopt a general ALLEGRO_THREAD_ID struct
and add a function al_thread_equal to match al_pthread_equal.
I would like to hear about your intended use case.
I have used pthread_self before, but almost only for debugging.
Peter
[1]: http://sourceware.org/ml/pthreads-win32/2011/msg00000.html