[M3devel] threading on Windows?

Mika Nystrom mika at async.caltech.edu
Sat Feb 12 03:08:36 CET 2011


I forgot to add that I was running that program on the platform LINUXLIBC6.

On FreeBSD4 I get the following bizarre behavior (program hangs):

(gdb) run -tests tryexcept
Starting program: /big/home/mika/cm3-writable/cm3/m3-libs/m3core/tests/thread/FreeBSD4/threadtest -tests tryexcept
Writing file...done
Creating tryexcept threads...done
running...printing oldest/median age/newest
.^C
Program received signal SIGINT, Interrupt.
[Switching to Thread 1 (LWP 100315)]
0x681093f3 in pthread_testcancel () from /usr/lib/libpthread.so.1

(gdb) where
#0  0x681093f3 in pthread_testcancel () from /usr/lib/libpthread.so.1
#1  0x680f917c in sigaction () from /usr/lib/libpthread.so.1
#2  0x680f9d03 in sigaction () from /usr/lib/libpthread.so.1
#3  0x680f850b in sigaction () from /usr/lib/libpthread.so.1
#4  0x680f828c in sigaction () from /usr/lib/libpthread.so.1
#5  0x6810192e in pthread_mutexattr_init () from /usr/lib/libpthread.so.1
#6  0x00000000 in ?? ()
(gdb) 

Even though I am using ThreadPosix, not ThreadPthread...

Also on AMD64_LINUX, the following:

(gdb) run -tests tryexcept
Starting program: /home/mika/cm3/cm3/m3-libs/m3core/tests/thread/AMD64_LINUX/threadtest -tests tryexcept
[Thread debugging using libthread_db enabled]
Writing file...done
Creating tryexcept threads...done
running...printing oldest/median age/newest
.[New Thread 0x2b7877844620 (LWP 24086)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x2b7877844620 (LWP 24086)]
0x00007fff44dff5b1 in ?? ()
(gdb) where
#0  0x00007fff44dff5b1 in ?? ()
#1  0x00007fff44dff6a5 in gettimeofday ()
#2  0x00002b787589690a in gettimeofday () from /lib/libc.so.6
#3  0x000000000045148f in TimePosix__Now ()
    at ../src/time/POSIX/TimePosixC.c:58
#4  0x000000000045139e in Time__Now () at ../src/time/POSIX/TimePosix.m3:14
#5  0x0000000000404da7 in Main__TApply (cl=Cannot access memory at address 0x2b7974014e68
) at ../src/Main.m3:205
#6  0x000000000044b3fb in ThreadPosix__RunThread ()
    at ../src/thread/POSIX/ThreadPosix.m3:993
#7  0x00002b787584b7b0 in ?? () from /lib/libc.so.6
#8  0x0000000000000000 in ?? ()
(gdb) 

AMD64_FREEBSD seems to work, oddly enough, but slowly.

I wonder if my compiler buidling has failed somehow (I am using the
Python script following a recipe provided by Jay after modifying
m3core/src/thread/m3makefile )

    Mika


Mika Nystrom writes:
>
>Hello m3devel,
>
>I'm attempting to test the CVS head as of Jay's latest checkins with
>the thread tester.
>
>I'm afraid there seems to be something wrong.
>
>I get a seg fault when running a few threads that do the following:
>
>PROCEDURE TApply(cl : Closure) : REFANY =
>  BEGIN
>    Thread.Pause(InitPause);
>    LOOP
>      TRY
>        WITH now = Time.Now() DO
>          times1[cl.id]:= FLOOR(now);
>          IF now < 0.0d0 THEN RAISE X END
>        END
>      EXCEPT X => <*ASSERT FALSE*>
>      END
>    END
>  END TApply;
>
>The crash is as follows:
>
>(gdb) run -tests tryexcept
>Starting program: /home/mika/cm3-cvs/cm3/m3-libs/m3core/tests/thread/LINUXLIBC
>6/threadtest -tests tryexcept
>[Thread debugging using libthread_db enabled]
>Writing file...done
>Creating tryexcept threads...done
>running...printing oldest/median age/newest
>.
>Program received signal SIGSEGV, Segmentation fault.
>0x0808cc0f in TimePosix__Now () at ../src/time/POSIX/TimePosixC.c:53
>53      {
>(gdb) where
>#0  0x0808cc0f in TimePosix__Now () at ../src/time/POSIX/TimePosixC.c:53
>#1  0x0808cb57 in Time__Now () at ../src/time/POSIX/TimePosix.m3:14
>#2  0x0804b875 in Main__TApply (cl=<error reading variable>)
>    at ../src/Main.m3:205
>#3  0x08086c5e in ThreadPosix__RunThread ()
>    at ../src/thread/POSIX/ThreadPosix.m3:993
>#4  0x400c343b in makecontext () from /lib/libc.so.6
>#5  0x00000000 in ?? ()
>(gdb) 
>
>Note I am using user threads since pthreads are known to be buggy at the
>moment.
>
>I would like to find one configuration (any configuration!!) that lets
>me run a multithreaded program under AMD64_LINUX.  I don't care what
>version of the compiler it is, whether the threads are user or pthreads,
>how many things I have to hack.  Does anyone know what I need to do?
>
>     Mika



More information about the M3devel mailing list