[Openmcl-devel] Probable Threading Problem (HOWTO request!)
Brent Fulgham
bfulg at pacbell.net
Sun Jan 21 19:59:01 PST 2007
I have a problem with the AgentSheets "Open Agent Engine" library
when trying to zoom/pan a scene while animations are running. A
great majority of the time, if I attempt to do so, I immediately get
an error:
;Loading #P"Game Engine.lisp"...
;Loading #P"Transparent-OpenGL-Window.lisp"...
Welcome to OpenMCL Version 1.1-pre-061231 (DarwinPPC32)!
? (load "Examples/Apocalypse Now")
;Loading #P"Examples/Apocalypse Now.lisp"...
#P"/Users/brent/Projects/Lisp/Open_Agent_Engine/Examples/Apocalypse
Now.lisp"
? (defvar *A* (make-instance 'ccl::chopper-window))
*A*
? (ccl::start-animation *A*)
(#<CCL::CHOPPER-WINDOW #x8D54D9E>)
? Unhandled exception 4 at 0x10000c, context->regs at #xbfffbcc8
Illegal instruction (0x00000000) at 0x10000c
In foreign code at address 0x0010000c
? for help
[310] OpenMCL kernel debugger:
A backtrace indicates that the problem may be that two threads are
trying to perform OpenGL calls at the same time. The first is being
called by the "TRACK-MOUSE-3D" stuff triggered by a mouse-down event,
and the other is calling AGLSWAPBUFFERS as part of the main animation
loop.
It seems like I need some kind of thread concurrency problem that
needs some mechanism for controlling which threads are allowed to
access the GL context. I don't know if the original MCL provided
this mechanism behind the scenes, but the same code that works fine
under MCL 5.1 results in this nasty crash under OpenMCL 1.1 (as of
this past Friday's update).
Can anyone provide any suggestions for attacking this problem? For
now, I think I need to read up on threading primitives and whether I
can create an easy 'critical section' or other process control
structure to prevent multiple threads from attempting to update the
AGL context.
Thanks,
-Brent
========== Kernel backtrace =========================
[310] OpenMCL kernel debugger: b
current thread: tcr = 0x3004c0, native thread ID = 0x113, interrupts
enabled
(#xbfffc1b0) #x85498DC4 : _gleForceToSoftwareTCL + 652
(#xbfffc220) #x853C7AAC : _glMaterialfv_Exec + 80
(#xbfffc2a0) #x00006650 : _SPpoweropen_ffcall + 200
(#xBFFFC2E0) #x08CB23E0 : #<Function GLMATERIALFV #x08cb23ee> + 260
(#xBFFFC2F0) #x08D543EC : #<Method-Function DISPLAY (CHOPPER)
#x08d54996> + 144
(#xBFFFC300) #x000060F8 : (subprimitive _ret1valn)
(#xBFFFC310) #x041B2154 : #<Function %%BEFORE-AND-AFTER-COMBINED-
METHOD-DCODE #x080802b6> + 624
(#xBFFFC320) #x000060F8 : (subprimitive _ret1valn)
(#xBFFFC330) #x041B29A0 : #<Function %%STANDARD-COMBINED-METHOD-DCODE
#x08080bc6> + 148
(#xBFFFC340) #x000087B0 : (subprimitive _popj)
(#xBFFFC350) #x08D1597C : #<Method-Function DISPLAY (OPENGL-SIMPLE-
VIEW) #x08d159ee> + 120
(#xBFFFC360) #x08D29700 : #<Method-Function VIEW-DRAW-CONTENTS
(OPENGL-WINDOW) #x08d2973e> + 76
(#xBFFFC370) #x08D0B3B0 : #<Method-Function TRACK-MOUSE-SPIN (CAMERA
T) #x08d0b3d6> + 1500
(#xBFFFC380) #x08CFE3F4 : #<Method-Function TRACK-MOUSE-3D (CAMERA)
#x08cfe41e> + 232
(#xBFFFC390) #x000060F8 : (subprimitive _ret1valn)
(#xBFFFC3A0) #x041B1E7C : #<Function %CALL-NEXT-METHOD #x0807ffd6> + 552
(#xBFFFC3B0) #x041B1D04 : #<Function %CALL-NEXT-METHOD #x0807ffd6> + 176
(#xBFFFC3C0) #x000060F8 : (subprimitive _ret1valn)
(#xBFFFC3D0) #x041B2A80 : #<Function %%STANDARD-COMBINED-METHOD-DCODE
#x08080bc6> + 372
(#xBFFFC3E0) #x000087B0 : (subprimitive _popj)
(#xBFFFC3F0) #x08C6A4C0 : #<Function -[CocoaView mouseDown:]
#x08c6a596> + 1764
(#xBFFFC400) #x08C6A514 : #<Function -[CocoaView mouseDown:]
#x08c6a596> + 1848
(#xBFFFC410) #x000060F8 : (subprimitive _ret1valn)
(#xBFFFC420) #x04199978 : #<Function %PASCAL-FUNCTIONS% #x080627c6> +
228
(#xBFFFC430) #x000085B4 : (subprimitive _SPpoweropen_callback)
(#xbfffc440) #x93767890 : -[NSWindow sendEvent:] + 4616
(#xBFFFCB50) #x088A8F4C : #<Function -[LispApplication sendEvent:]
#x088a9036> + 2144
(#xbfffcb60) #x00000000 : (null) + 0
(#xBFFFCBB0) #x088A8F5C : #<Function -[LispApplication sendEvent:]
#x088a9036> + 2160
(#xBFFFCBC0) #x088A8DBC : #<Function -[LispApplication sendEvent:]
#x088a9036> + 1744
(#xBFFFCBD0) #x088A8FB4 : #<Function -[LispApplication sendEvent:]
#x088a9036> + 2248
(#xBFFFCBE0) #x000060F8 : (subprimitive _ret1valn)
(#xBFFFCBF0) #x04199978 : #<Function %PASCAL-FUNCTIONS% #x080627c6> +
228
(#xBFFFCC00) #x000085B4 : (subprimitive _SPpoweropen_callback)
(#xbfffcc10) #x93707D10 : -[NSApplication run] + 508
(#xBFFFD1E0) #x088B068C : #<Function RUN-EVENT-LOOP #x088b0916> + 488
(#xbfffd1f0) #x00000000 : (null) + 0
(#xBFFFD240) #x088B06A0 : #<Function RUN-EVENT-LOOP #x088b0916> + 508
(#xBFFFD250) #x088B0570 : #<Function RUN-EVENT-LOOP #x088b0916> + 204
(#xBFFFD260) #x088B06D8 : #<Function RUN-EVENT-LOOP #x088b0916> + 564
(#xBFFFD270) #x00009ECC : (subprimitive toplevel_loop)
(#xBFFFD280) #x00009ED8 : (subprimitive toplevel_loop)
(#xbfffd290) #x00009FE4 : _start_lisp + 244
TCR = 0x301ab0, cstack area #x301be0, native thread ID = 0x3603,
interrupts enabled
(#xF0135AE0) #x04216074 : #<Function FD-INPUT-AVAILABLE-P #x081112de>
+ 360
(#xF0135AF0) #x042162A4 : #<Function PROCESS-INPUT-WAIT #x081117d6> +
144
(#xF0135B00) #x0421B748 : #<Function FD-STREAM-ADVANCE #x08119176> + 468
(#xF0135B10) #x041E9280 : #<Function %IOBLOCK-PEEK-CHAR #x080dff0e> +
316
(#xF0135B20) #x04206A9C : #<Method-Function STREAM-PEEK-CHAR (BASIC-
CHARACTER-INPUT-STREAM) #x080ec6f6> + 320
(#xF0135B30) #x04206A04 : #<Method-Function STREAM-PEEK-CHAR (BASIC-
CHARACTER-INPUT-STREAM) #x080ec6f6> + 168
(#xF0135B40) #x0434B8A0 : #<Function PEEK-CHAR #x0838c1ce> + 252
(#xF0135B50) #x04219978 : #<Method-Function READ-TOPLEVEL-FORM (INPUT-
STREAM T) #x08115086> + 84
(#xF0135B60) #x000060F8 : (subprimitive _ret1valn)
(#xF0135B70) #x041B2154 : #<Function %%BEFORE-AND-AFTER-COMBINED-
METHOD-DCODE #x080802b6> + 624
(#xF0135B80) #x000060F8 : (subprimitive _ret1valn)
(#xF0135B90) #x041B29A0 : #<Function %%STANDARD-COMBINED-METHOD-DCODE
#x08080bc6> + 148
(#xF0135BA0) #x000060F8 : (subprimitive _ret1valn)
(#xF0135BB0) #x00006204 : (subprimitive _nvalret)
(#xF0135BC0) #x000060F8 : (subprimitive _ret1valn)
(#xF0135BD0) #x04266158 : #<Function READ-LOOP #x081d6bd6> + 692
(#xF0135BE0) #x04266234 : #<Function READ-LOOP #x081d6bd6> + 912
(#xF0135BF0) #x04266260 : #<Function READ-LOOP #x081d6bd6> + 956
(#xF0135C00) #x0426628C : #<Function READ-LOOP #x081d6bd6> + 1000
(#xF0135C10) #x0425FF10 : #<Function TOPLEVEL-LOOP #x081c9036> + 124
(#xF0135C20) #x0425FF18 : #<Function TOPLEVEL-LOOP #x081c9036> + 132
(#xF0135C30) #x04251488 : #<Anonymous Function #x08173d66> + 68
(#xF0135C40) #x000060F8 : (subprimitive _ret1valn)
(#xF0135C50) #x04278598 : #<Anonymous Function #x082088ce> + 356
(#xF0135C60) #x04278484 : #<Anonymous Function #x082088ce> + 80
(#xF0135C70) #x0424F24C : #<Function RUN-PROCESS-INITIAL-FORM
#x0816d8f6> + 400
(#xF0135C80) #x0424F288 : #<Function RUN-PROCESS-INITIAL-FORM
#x0816d8f6> + 460
(#xF0135C90) #x0424F39C : #<Function RUN-PROCESS-INITIAL-FORM
#x0816d8f6> + 736
(#xF0135CA0) #x000060F8 : (subprimitive _ret1valn)
(#xF0135CB0) #x0424F51C : #<Anonymous Function #x0816da36> + 152
(#xF0135CC0) #x0424F504 : #<Anonymous Function #x0816da36> + 128
(#xF0135CD0) #x0424AD38 : #<Anonymous Function #x08164c6e> + 172
(#xF0135CE0) #x00009ECC : (subprimitive toplevel_loop)
(#xF0135CF0) #x00009ED8 : (subprimitive toplevel_loop)
(#xf0135d00) #x00009FE4 : _start_lisp + 244
(#xf0135dc0) #x00016E3C : _lisp_thread_entry + 220
(#xf0135e30) #x9002B508 : __pthread_body + 96
(#xf0135f00) #x00000000 : (null) + 0
TCR = 0x3236d0, cstack area #x3238a0, native thread ID = 0x6e03,
interrupts enabled
(#xF02E9C50) #x0424B7DC : #<Function %NANOSLEEP #x08165bc6> + 272
(#xF02E9C60) #x088B19F8 : #<Anonymous Function #x088b1a1e> + 76
(#xF02E9C70) #x0424F24C : #<Function RUN-PROCESS-INITIAL-FORM
#x0816d8f6> + 400
(#xF02E9C80) #x0424F288 : #<Function RUN-PROCESS-INITIAL-FORM
#x0816d8f6> + 460
(#xF02E9C90) #x0424F39C : #<Function RUN-PROCESS-INITIAL-FORM
#x0816d8f6> + 736
(#xF02E9CA0) #x000060F8 : (subprimitive _ret1valn)
(#xF02E9CB0) #x0424F51C : #<Anonymous Function #x0816da36> + 152
(#xF02E9CC0) #x0424F504 : #<Anonymous Function #x0816da36> + 128
(#xF02E9CD0) #x0424AD38 : #<Anonymous Function #x08164c6e> + 172
(#xF02E9CE0) #x00009ECC : (subprimitive toplevel_loop)
(#xF02E9CF0) #x00009ED8 : (subprimitive toplevel_loop)
(#xf02e9d00) #x00009FE4 : _start_lisp + 244
(#xf02e9dc0) #x00016E3C : _lisp_thread_entry + 220
(#xf02e9e30) #x9002B508 : __pthread_body + 96
(#xf02e9f00) #x00000000 : (null) + 0
TCR = 0x37dec0, cstack area #x37e030, native thread ID = 0xa303,
interrupts enabled
(#xF041CBC0) #x0421905C : #<Function %WAIT-ON-SEMAPHORE-PTR
#x0811442e> + 400
(#xF041CBD0) #x0425382C : #<Function PROCESS-WAIT #x0817b256> + 248
(#xF041CBE0) #x042537C0 : #<Function PROCESS-WAIT #x0817b256> + 140
(#xF041CBF0) #x04218E24 : #<Function WAIT-ON-SEMAPHORE #x08114236> + 112
(#xF041CC00) #x0895B5A8 : #<Function DEQUEUE-KEY-EVENT #x0895b5ce> + 188
(#xF041CC10) #x0895A0C4 : #<Function GET-KEY-EVENT #x0895a216> + 72
(#xF041CC20) #x08994C44 : #<Function %COMMAND-LOOP #x08994fce> + 648
(#xF041CC30) #x08994ADC : #<Function %COMMAND-LOOP #x08994fce> + 288
(#xF041CC40) #x08BDE9BC : #<Function HEMLOCK-THREAD-FUNCTION
#x08bdea06> + 872
(#xF041CC50) #x08BDE9D4 : #<Function HEMLOCK-THREAD-FUNCTION
#x08bdea06> + 896
(#xF041CC60) #x08BDE8AC : #<Function HEMLOCK-THREAD-FUNCTION
#x08bdea06> + 600
(#xF041CC70) #x0424F24C : #<Function RUN-PROCESS-INITIAL-FORM
#x0816d8f6> + 400
(#xF041CC80) #x0424F288 : #<Function RUN-PROCESS-INITIAL-FORM
#x0816d8f6> + 460
(#xF041CC90) #x0424F39C : #<Function RUN-PROCESS-INITIAL-FORM
#x0816d8f6> + 736
(#xF041CCA0) #x000060F8 : (subprimitive _ret1valn)
(#xF041CCB0) #x0424F51C : #<Anonymous Function #x0816da36> + 152
(#xF041CCC0) #x0424F504 : #<Anonymous Function #x0816da36> + 128
(#xF041CCD0) #x0424AD38 : #<Anonymous Function #x08164c6e> + 172
(#xF041CCE0) #x00009ECC : (subprimitive toplevel_loop)
(#xF041CCF0) #x00009ED8 : (subprimitive toplevel_loop)
(#xf041cd00) #x00009FE4 : _start_lisp + 244
(#xf041cdc0) #x00016E3C : _lisp_thread_entry + 220
(#xf041ce30) #x9002B508 : __pthread_body + 96
(#xf041cf00) #x00000000 : (null) + 0
TCR = 0x37f470, cstack area #x37f520, native thread ID = 0xc203,
interrupts enabled
(#xF05D0A70) #x04216074 : #<Function FD-INPUT-AVAILABLE-P #x081112de>
+ 360
(#xF05D0A80) #x042162A4 : #<Function PROCESS-INPUT-WAIT #x081117d6> +
144
(#xF05D0A90) #x0421B748 : #<Function FD-STREAM-ADVANCE #x08119176> + 468
(#xF05D0AA0) #x041E9280 : #<Function %IOBLOCK-PEEK-CHAR #x080dff0e> +
316
(#xF05D0AB0) #x04214E24 : #<Method-Function STREAM-PEEK-CHAR
(BUFFERED-CHARACTER-INPUT-STREAM-MIXIN) #x0810d45e> + 360
(#xF05D0AC0) #x04214D94 : #<Method-Function STREAM-PEEK-CHAR
(BUFFERED-CHARACTER-INPUT-STREAM-MIXIN) #x0810d45e> + 216
(#xF05D0AD0) #x0434B8A0 : #<Function PEEK-CHAR #x0838c1ce> + 252
(#xF05D0AE0) #x04219978 : #<Method-Function READ-TOPLEVEL-FORM (INPUT-
STREAM T) #x08115086> + 84
(#xF05D0AF0) #x000060F8 : (subprimitive _ret1valn)
(#xF05D0B00) #x041B1E7C : #<Function %CALL-NEXT-METHOD #x0807ffd6> + 552
(#xF05D0B10) #x041B1D04 : #<Function %CALL-NEXT-METHOD #x0807ffd6> + 176
(#xF05D0B20) #x0421972C : #<Method-Function READ-TOPLEVEL-FORM
(SELECTION-INPUT-STREAM T) #x08114c36> + 88
(#xF05D0B30) #x000060F8 : (subprimitive _ret1valn)
(#xF05D0B40) #x041B2A80 : #<Function %%STANDARD-COMBINED-METHOD-DCODE
#x08080bc6> + 372
(#xF05D0B50) #x000060F8 : (subprimitive _ret1valn)
(#xF05D0B60) #x00006204 : (subprimitive _nvalret)
(#xF05D0B70) #x000060F8 : (subprimitive _ret1valn)
(#xF05D0B80) #x041B2154 : #<Function %%BEFORE-AND-AFTER-COMBINED-
METHOD-DCODE #x080802b6> + 624
(#xF05D0B90) #x000060F8 : (subprimitive _ret1valn)
(#xF05D0BA0) #x041B29A0 : #<Function %%STANDARD-COMBINED-METHOD-DCODE
#x08080bc6> + 148
(#xF05D0BB0) #x000060F8 : (subprimitive _ret1valn)
(#xF05D0BC0) #x00006204 : (subprimitive _nvalret)
(#xF05D0BD0) #x000060F8 : (subprimitive _ret1valn)
(#xF05D0BE0) #x04266158 : #<Function READ-LOOP #x081d6bd6> + 692
(#xF05D0BF0) #x04266234 : #<Function READ-LOOP #x081d6bd6> + 912
(#xF05D0C00) #x04266260 : #<Function READ-LOOP #x081d6bd6> + 956
(#xF05D0C10) #x0426628C : #<Function READ-LOOP #x081d6bd6> + 1000
(#xF05D0C20) #x0425FF10 : #<Function TOPLEVEL-LOOP #x081c9036> + 124
(#xF05D0C30) #x0425FF18 : #<Function TOPLEVEL-LOOP #x081c9036> + 132
(#xF05D0C40) #x000060F8 : (subprimitive _ret1valn)
(#xF05D0C50) #x04278598 : #<Anonymous Function #x082088ce> + 356
(#xF05D0C60) #x04278484 : #<Anonymous Function #x082088ce> + 80
(#xF05D0C70) #x0424F24C : #<Function RUN-PROCESS-INITIAL-FORM
#x0816d8f6> + 400
(#xF05D0C80) #x0424F288 : #<Function RUN-PROCESS-INITIAL-FORM
#x0816d8f6> + 460
(#xF05D0C90) #x0424F39C : #<Function RUN-PROCESS-INITIAL-FORM
#x0816d8f6> + 736
(#xF05D0CA0) #x000060F8 : (subprimitive _ret1valn)
(#xF05D0CB0) #x0424F51C : #<Anonymous Function #x0816da36> + 152
(#xF05D0CC0) #x0424F504 : #<Anonymous Function #x0816da36> + 128
(#xF05D0CD0) #x0424AD38 : #<Anonymous Function #x08164c6e> + 172
(#xF05D0CE0) #x00009ECC : (subprimitive toplevel_loop)
(#xF05D0CF0) #x00009ED8 : (subprimitive toplevel_loop)
(#xf05d0d00) #x00009FE4 : _start_lisp + 244
(#xf05d0dc0) #x00016E3C : _lisp_thread_entry + 220
(#xf05d0e30) #x9002B508 : __pthread_body + 96
(#xf05d0f00) #x00000000 : (null) + 0
TCR = 0x37f8d0, cstack area #x3aa630, native thread ID = 0xe61b,
interrupts enabled
(#xF0886BD0) #x08CD7768 : #<Function AGLSWAPBUFFERS #x08cd7776> + 84
(#xF0886BE0) #x08D2971C : #<Method-Function VIEW-DRAW-CONTENTS
(OPENGL-WINDOW) #x08d2973e> + 104
(#xF0886BF0) #x08D1674C : #<Method-Function ANIMATE-OPENGL-VIEWS-ONCE
(OPENGL-SIMPLE-VIEW) #x08d1677e> + 80
(#xF0886C00) #x000060F8 : (subprimitive _ret1valn)
(#xF0886C10) #x041B1E7C : #<Function %CALL-NEXT-METHOD #x0807ffd6> + 552
(#xF0886C20) #x041B1D04 : #<Function %CALL-NEXT-METHOD #x0807ffd6> + 176
(#xF0886C30) #x000060F8 : (subprimitive _ret1valn)
(#xF0886C40) #x041B2A80 : #<Function %%STANDARD-COMBINED-METHOD-DCODE
#x08080bc6> + 372
(#xF0886C50) #x000087B0 : (subprimitive _popj)
(#xF0886C60) #x08D162B0 : #<Anonymous Function #x08d162f6> + 84
(#xF0886C70) #x0424F24C : #<Function RUN-PROCESS-INITIAL-FORM
#x0816d8f6> + 400
(#xF0886C80) #x0424F288 : #<Function RUN-PROCESS-INITIAL-FORM
#x0816d8f6> + 460
(#xF0886C90) #x0424F39C : #<Function RUN-PROCESS-INITIAL-FORM
#x0816d8f6> + 736
(#xF0886CA0) #x000060F8 : (subprimitive _ret1valn)
(#xF0886CB0) #x0424F51C : #<Anonymous Function #x0816da36> + 152
(#xF0886CC0) #x0424F504 : #<Anonymous Function #x0816da36> + 128
(#xF0886CD0) #x0424AD38 : #<Anonymous Function #x08164c6e> + 172
(#xF0886CE0) #x00009ECC : (subprimitive toplevel_loop)
(#xF0886CF0) #x00009ED8 : (subprimitive toplevel_loop)
(#xf0886d00) #x00009FE4 : _start_lisp + 244
(#xf0886dc0) #x00016E3C : _lisp_thread_entry + 220
(#xf0886e30) #x9002B508 : __pthread_body + 96
(#xf0886f00) #x00000000 : (null) + 0
[310] OpenMCL kernel debugger:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20070121/31de33fc/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20070121/31de33fc/attachment.bin>
More information about the Openmcl-devel
mailing list