[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] pthreads ?



Here's just my 5cent for the topic:

It is sometimes assumed that pth drawback is missing concurrent
multithreading. But It's not that bad - you don't have to call pth_yield /
pthread_yield by yourself. At least not when your thread is waiting
for/doing I/O. All the calls to poll/select/read/write/connect (and also
other calls...) are wrapped by pth - and the wrappers care about
threading. so if your thread has a loop like:

while( do_io_stuff ) {
  if( select() ){
   read()
  }
}

you don't have to call pth_yield manually. The above code should pass
control to the other running threads, if the scheduler says to do so.
There is also an message system within pth - it maybe also allows to code
threaded without manually calling pth_yield.

pth produces alot of debug output and it seems there is some problem with
mutexes, at least Netscapes portable runtime library often fails during
make test because of: assert( mutex_is_locked() ) .

Greets,
m