Hello!

  A fun observation. Sometimes, when the Factor application is not immediately 
terminated and an error dialog is shown on screen, I can inspect it with the 
Process Explorer and see that my busy-loop thread is in there, created and 
running.

27.05.2016, 23:16, "Alexander Ilin" <ajs...@yandex.ru>:
> Hello!
>
> 27.05.2016, 20:00, "Björn Lindqvist" <bjou...@gmail.com>:
>>  Try defining <ThreadProc> like this:
>>
>>  : <ThreadProc> ( -- alien ) DWORD { LPVOID } stdcall [ ] alien-callback ;
>
>   Tried this, see below.
>
>   I'm now at home, trying these things on Win 8.1 64-bit, on a freshly 
> bootstrapped Factor. (For some reason the build.cmd produced a 32-bit 
> executable, even though I'm on a 64-bit system.) The Windows Error Reporting 
> tool (WerFault.exe) says that an exception is happening. Sometimes I get to 
> see some kind of dumps in the console, sometimes not.
>
>   Here's my code:
>
> USING: kernel windows.kernel32
>     alien alien.data alien.syntax windows.types ;
> IN: my-thd
>
> LIBRARY: kernel32
>
> FUNCTION: HANDLE CreateThread ( LPSECURITY_ATTRIBUTES lpThreadAttributes,
>                                 SIZE_T dwStackSize,
>                                 LPVOID lpStartAddress,
>                                 LPVOID lpParameter,
>                                 DWORD dwCreationFlags,
>                                 LPDWORD lpThreadId )
>
> CALLBACK: DWORD ThreadProc ( LPVOID lpParameter )
>
> : <ThreadProc> ( -- alien )
>   [ [ t ] [ ] while ] ThreadProc ;
>
> : <ThreadProc-2> ( -- alien )
>   DWORD { LPVOID } stdcall [ ] alien-callback ;
>
> : <ThreadProc-3> ( -- alien )
>   DWORD { LPVOID } stdcall [ [ t ] [ ] while ] alien-callback ;
>
> : start-thd ( -- hnd )
>     f 0 <ThreadProc> f 0 f CreateThread ;
>
> : start-thd-2 ( -- hnd )
>     f 0 <ThreadProc-2> f 0 f CreateThread ;
>
> : start-thd-3 ( -- hnd )
>     f 0 <ThreadProc-3> f 0 f CreateThread ;
>
>   Test runs and results:
>   start-thd: the app sometimes dies with no output. WerFault sometimes 
> reports Exception Code c0000409, which Googles to "Stack buffer overflow", 
> and sometimes c0000005, which is "access violation". Sometimes I see a 
> console dump, which starts with "fatal_error: Memory protection fault during 
> gc: <hex-value>".
>
>   start-thd-2: most of the time dies with no output, but once I saw the text 
> "Error in print-error!" on the console.
>
>   start-thd-3: most of the time dies with no output, but once I saw a message 
> box with "Memory protection fault at address 0x105" in it.
>
>   Can you help me? I need more code to try.

---=====---
 Александр

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to