Hi!
Have you tried SDL-1.2.5/test/testtimer?
If it works good, then
The testtimer works fine here.
- have you initialized SDL with SDL_INIT_TIMER?
- how did you install pth?
Through pkgsrc.
. if by pkgsrc, which did you use? devel/pth or devel/pth-syscall
?
It’s devel/pth-1.4.1nb2. There is no longer any package like
devel/pth-syscall. pth-1.4.1nb2 use the --enable-syscall-hard option.
/* . if you use devel/pth, pre-defining
_POSIX_THREAD_SYSCALL_SOFT=1 makes some progress? */
3. what does your SDL-1.2.5/config.log say about detecting
pthread/pth ?
SDL is configured with --disable-pthreads --enable-pth.
config.log:
configure:5760: checking for pthread-config
configure:5804: checking pth
BTW, I runned a tiny program (like following) on my NetBSD box
(NetBSD 1.6BETA1, SDL-1.2.5, pth-syscall-1.4.1nb1) and it works
good.
…
Yes, work here too:
gcc -o sdl-test -Wall sdl-test.c -I/usr/pkg/include/SDL -L/usr/pkg/lib
-lSDL -lpth
./sdl-test
waiting…
2: 0
12: 1
32: 2
52: 3
72: 4
…
I’ve investigated this issue with a friend of mine… It don’t know much
about the pth vs. pthread lib issues, but it seems that pth implements
thread emulation for possibly non-preemptive OSes. If this is true and
since NetBSD supports native preemptive threading then the NetBSD port
should be built against the pthread to support OS native preemptive
threads.
Anyway if the pth is used than the timer stuff doesn’t work under
some circumstances.
– snip –
Perhaps SDL_Delay(20*1000) right after the SDL_AddTimer() would help?
Also add a printf(“YEAH\n”) to the begining of the callback function.
I think I now the reason. As SDL is compiled with pth lib the thread model
is user space, non-preemptive. So the thread switching is only done if a
syscall is done (pth lib with syscall mapping hard) or if the pth
scheduler is explicitly called.
– end snip –
This issue is possibly related to the mail:> Date: Mon, 28 Oct 2002 20:49:51 +0100
From: Patrice Mandin
Subject: pth support/detection in configure.in
best regards
STan