On Tue, Apr 01, 2003 at 12:15:44PM -0800, Steve Alstrin wrote:

> I compiled the test program, included with distro, and it appears that no
> thread will start until a join is done on it. When I compile the test
> program "test_pthread" with native threads the threads start after the
> pthread_create call, whereas when compiled with pth threads, each thread
> only starts when the join for that thread is done, and will not allow the
> other threads to run until the previous join has completed.
> 
> Is this a bug, or does all the other thread packages behave incorrectly?
> 
> Any help would be greatly appreciated, i.e. my job depends on it.

I am not 100% sure if I understand the question, but I have the impression
that your problem may be related to the non-preemptive nature of PTh...
Your applications should either call pth_yield() or pth_*() IO functions
(which can internally be called automatically by standard syscalls if
PTh was compiled with hard-syscall option) for it to delegate control back
to the CPU and therefore allow other threads to execute. (The same applies
calling pthread_*() functions rather than the Pth specific pth_*() ones)

Hmm also make sure that you are using pth(read)_join() according to
POSIX defined semantics (threads should only be joined when the current
thread wants to wait until thread termination, and that thread should not
have been started using the asynchroneous flag). Otherwise, if the threads
were started using the asynchroneous DETACH flag, they are expected to
free their resources and exit naturally themselves at pth(read)_exit(),
and should not be joined. This behavior is expected for all POSIX
pthread_*() functions, no matter the implementation.

Hope this helps,

Matt

______________________________________________________________________
GNU Portable Threads (Pth)            http://www.gnu.org/software/pth/
Development Site                      http://www.ossp.org/pkg/lib/pth/
Distribution Files                          ftp://ftp.gnu.org/gnu/pth/
Distribution Snapshots                 ftp://ftp.ossp.org/pkg/lib/pth/
User Support Mailing List                            [EMAIL PROTECTED]
Automated List Manager (Majordomo)           [EMAIL PROTECTED]

Reply via email to