Re: [Factor-talk] Issue #1573: interrupt a tight loop

2016-05-27 Thread John Benediktsson
>
>   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.


IIRC, there are x86 (32-bit) and x64 (64-bit) versions of some of the VS
Command Prompt shortcuts and they setup environment variables that will
cause a 32-bit or 64-bit factor to be produced.
--
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


Re: [Factor-talk] Build Factor on Windows with Win7 SDK

2016-05-27 Thread Alexander Ilin
Hi again! 27.05.2016, 02:10, "Alexander Ilin" :That I'll have to try tomorrow, I'm afraid. 2:30 a.m. here. VS 2015 Community Edition did the trick, although not before I fixed a C4800 warning (treated as error, thus failing the build).My first successful bootstrap! Pull request with the fix is posted. ---=---Александр 

--
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


Re: [Factor-talk] Issue #1573: interrupt a tight loop

2016-05-27 Thread Björn Lindqvist
Try defining  like this:

:  ( -- alien ) DWORD { LPVOID } stdcall [ ] alien-callback ;

2016-05-27 18:03 GMT+02:00 Alexander Ilin :
> Hello, John!
>
> 27.05.2016, 18:55, "John Benediktsson" :
>> If you run it from the command prompt does it print an error message when it 
>> exits?
>
>   As I said, no message boxes, nothing on the console.
>
> ---=---
>  Александр
>
> --
> 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



-- 
mvh/best regards Björn Lindqvist

--
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


Re: [Factor-talk] Issue #1573: interrupt a tight loop

2016-05-27 Thread Alexander Ilin
Hello, John!

27.05.2016, 18:55, "John Benediktsson" :
> If you run it from the command prompt does it print an error message when it 
> exits?

  As I said, no message boxes, nothing on the console.

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

--
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


Re: [Factor-talk] Issue #1573: interrupt a tight loop

2016-05-27 Thread John Benediktsson
If you run it from the command prompt does it print an error message when it 
exits?

> On May 27, 2016, at 8:51 AM, Alexander Ilin  wrote:
> 
> Hello!
> 
> 27.05.2016, 18:04, "John Benediktsson" :
>> Why do you have a busy loop on the callback? Why not just yield and return 
>> out of it?
> 
>  The busy loop is there to keep the new thread alive long enough so that I 
> can see it in the Process Explorer. The 100% CPU utilization will 1) tell me 
> that it's running, 2) help me tell it apart from the Listener's main thread 
> hosted in the same process.
> 
>> Maybe the callback is locking up the listener?
> 
>  The Listener doesn't lock up, it quits immediately. I have to start 
> Factor.exe/com again.
> 
> ---=---
> Александр
> 
> --
> 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

--
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


Re: [Factor-talk] Issue #1573: interrupt a tight loop

2016-05-27 Thread Alexander Ilin
Hello!

27.05.2016, 18:04, "John Benediktsson" :
> Why do you have a busy loop on the callback? Why not just yield and return 
> out of it?

  The busy loop is there to keep the new thread alive long enough so that I can 
see it in the Process Explorer. The 100% CPU utilization will 1) tell me that 
it's running, 2) help me tell it apart from the Listener's main thread hosted 
in the same process.

> Maybe the callback is locking up the listener?

  The Listener doesn't lock up, it quits immediately. I have to start 
Factor.exe/com again.

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

--
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


Re: [Factor-talk] Issue #1573: interrupt a tight loop

2016-05-27 Thread John Benediktsson
Why do you have a busy loop on the callback?  Why not just yield and return out 
of it?  Maybe the callback is locking up the listener?

> On May 27, 2016, at 8:01 AM, Alexander Ilin  wrote:
> 
> Hello!
>  
> 27.05.2016, 17:35, "John Benediktsson" :
>> Since the 1234 is supposed to be a LPDWORD which I think should be a pointer 
>> wouldn't something like this work:
>>  
>> 1234 DWORD  
>>  
>> Note: I'm not a windows programmer, I just play one on TV.
>  
> Ha! : ))
>  
> That parameter is actually optional, according to the MSDN page on 
> CreateThread, so the following code should theoretically work:
>  
> USING: kernel windows.kernel32
> 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 )
>  
> :  ( -- alien )
>[ [ t ] [ ] while ] ThreadProc ;
>  
> : start-thd ( -- hnd )
>f 0  f 0 f CreateThread ;
>  
> It all compiles, but unfortunately, calling start-thd from the Listener 
> immediately terminates the Factor.com process. No message boxes, no console 
> output, nothing.
>  
> Any ideas?
>  
> ---=---
> Александр
>  
> --
> 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

--
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


Re: [Factor-talk] Issue #1573: interrupt a tight loop

2016-05-27 Thread Alexander Ilin
Hello! 27.05.2016, 17:35, "John Benediktsson" :Since the 1234 is supposed to be a LPDWORD which I think should be a pointer wouldn't something like this work:     1234 DWORD   Note: I'm not a windows programmer, I just play one on TV.  Ha! : )) That parameter is actually optional, according to the MSDN page on CreateThread, so the following code should theoretically work: USING: kernel windows.kernel32    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 ) :  ( -- alien )   [ [ t ] [ ] while ] ThreadProc ; : start-thd ( -- hnd )   f 0  f 0 f CreateThread ; It all compiles, but unfortunately, calling start-thd from the Listener immediately terminates the Factor.com process. No message boxes, no console output, nothing. Any ideas? ---=---Александр --
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


Re: [Factor-talk] Issue #1573: interrupt a tight loop

2016-05-27 Thread John Benediktsson
Since the 1234 is supposed to be a LPDWORD which I think should be a
pointer wouldn't something like this work:

1234 DWORD 

Note: I'm not a windows programmer, I just play one on TV.

It's not automatically converted to a pointer.

On Fri, May 27, 2016 at 7:30 AM, Alexander Ilin  wrote:

> Thanks, John!
>
> This code compiles:
> :  ( -- alien )
>[ [ t ] [ ] while ] ThreadProc ;
>
> : start-thread ( -- hnd )
> f 1024  f 0 1234 CreateThread ;
>
> However, trying to run it results in an error which I don't understand:
> Generic word underlying>> does not define a method for the fixnum class.
> Dispatching on object: 1234
>
> Should I wrap 1234 with an  or something?
>
> 27.05.2016, 16:52, "John Benediktsson" :
>
> Note, your  needs to use the name of the Callback (in this
> case "ThreadProc") I think:
>
> : 
> [ ] ThreadProc ;
>
>
>
> On Fri, May 27, 2016 at 6:47 AM, Alexander Ilin  wrote:
>
>
>
> 27.05.2016, 12:56, "Björn Lindqvist" :
> > Yes. See
> https://github.com/bjourne/playground-factor/wiki/Tips-and-Tricks-Alien#using-alien-callbacks
> > for an example on how to pass callbacks to c functions.
>
> > So if CreateThread has signature:
> >
> > FUNCTION: HANDLE CreateThread ( LPSECURITY_ATTRIBUTES lpThreadAttributes,
> > SIZE_T dwStackSize,
> > LPVOID lpStartAddress,
> > LPVOID lpParameter,
> > DWORD dwCreationFlags,
> > LPDWORD lpThreadId )
> >
> > You need to declare a callback:
> >
> > CALLBACK: DWORD ThreadProc ( LPVOID lpParameter )
> >
> > Then a callback maker:
> >
> > :  ( -- alien )
> > [ ] comparer ; <-replace [ ] with your code
> >
> > Then call it:
> >
> > f 1024  f 0 1234 CreateThread
>
>   Thank you very much, Björn, that's exactly the kind of help I need right
> now.
>   Unfortunately, pasting your code in the Listener hangs it for some
> reason.
>
>   I have changed the  so that it would sit just there in the
> new thread:
>
> :  ( -- alien )
> [ t ] [ ] while 0 ; ! 0 is the return value, otherwise stack checker
> complains.
>
>   In the Process Monitor I see 100% CPU utilization in the main Factor.exe
> thread, and I see no additional thread created.
>   What might be the problem?
>
> Factor 0.98 x86.32 (1769, heads/master-6b77c4f3da, Tue May 10 15:22:01
> 2016)
> [Microsoft Visual C++ 190023506] on windows XP Pro SP3
>
> ---=---
>  Александр
>
>
> --
> 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
>
> ,
>
>
> --
> 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
>
>
>
> ---=---
> Александр
>
>
>
> --
> 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
>
>
--
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. 

Re: [Factor-talk] Issue #1573: interrupt a tight loop

2016-05-27 Thread Alexander Ilin
Thanks, John! This code compiles::  ( -- alien )   [ [ t ] [ ] while ] ThreadProc ; : start-thread ( -- hnd )f 1024  f 0 1234 CreateThread ; However, trying to run it results in an error which I don't understand:Generic word underlying>> does not define a method for the fixnum class.Dispatching on object: 1234 Should I wrap 1234 with an  or something? 27.05.2016, 16:52, "John Benediktsson" :Note, your  needs to use the name of the Callback (in this case "ThreadProc") I think: :     [ ] ThreadProc ;   On Fri, May 27, 2016 at 6:47 AM, Alexander Ilin  wrote: 27.05.2016, 12:56, "Björn Lindqvist" :> Yes. See https://github.com/bjourne/playground-factor/wiki/Tips-and-Tricks-Alien#using-alien-callbacks> for an example on how to pass callbacks to c functions.> So if CreateThread has signature:>> FUNCTION: HANDLE CreateThread ( LPSECURITY_ATTRIBUTES lpThreadAttributes,> SIZE_T dwStackSize,> LPVOID lpStartAddress,> LPVOID lpParameter,> DWORD dwCreationFlags,> LPDWORD lpThreadId )>> You need to declare a callback:>> CALLBACK: DWORD ThreadProc ( LPVOID lpParameter )>> Then a callback maker:>> :  ( -- alien )> [ ] comparer ; <-replace [ ] with your code>> Then call it:>> f 1024  f 0 1234 CreateThread  Thank you very much, Björn, that's exactly the kind of help I need right now.  Unfortunately, pasting your code in the Listener hangs it for some reason.  I have changed the  so that it would sit just there in the new thread::  ( -- alien )    [ t ] [ ] while 0 ; ! 0 is the return value, otherwise stack checker complains.  In the Process Monitor I see 100% CPU utilization in the main Factor.exe thread, and I see no additional thread created.  What might be the problem?Factor 0.98 x86.32 (1769, heads/master-6b77c4f3da, Tue May 10 15:22:01 2016)[Microsoft Visual C++ 190023506] on windows XP Pro SP3---=--- Александр--What NetFlow Analyzer can do for you? Monitors network bandwidth and trafficpatterns at an interface-level. Reveals which users, apps, and protocols areconsuming the most bandwidth. Provides multi-vendor support for NetFlow,J-Flow, sFlow and other flows. Make informed decisions using capacityplanning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e___Factor-talk mailing listFactor-talk@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/factor-talk,--What NetFlow Analyzer can do for you? Monitors network bandwidth and trafficpatterns at an interface-level. Reveals which users, apps, and protocols areconsuming the most bandwidth. Provides multi-vendor support for NetFlow,J-Flow, sFlow and other flows. Make informed decisions using capacityplanning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e,___Factor-talk mailing listFactor-talk@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/factor-talk  ---=---Александр --
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


Re: [Factor-talk] Issue #1573: interrupt a tight loop

2016-05-27 Thread John Benediktsson
Note, your  needs to use the name of the Callback (in this case
"ThreadProc") I think:

: 
[ ] ThreadProc ;



On Fri, May 27, 2016 at 6:47 AM, Alexander Ilin  wrote:

>
>
> 27.05.2016, 12:56, "Björn Lindqvist" :
> > Yes. See
> https://github.com/bjourne/playground-factor/wiki/Tips-and-Tricks-Alien#using-alien-callbacks
> > for an example on how to pass callbacks to c functions.
>
> > So if CreateThread has signature:
> >
> > FUNCTION: HANDLE CreateThread ( LPSECURITY_ATTRIBUTES lpThreadAttributes,
> > SIZE_T dwStackSize,
> > LPVOID lpStartAddress,
> > LPVOID lpParameter,
> > DWORD dwCreationFlags,
> > LPDWORD lpThreadId )
> >
> > You need to declare a callback:
> >
> > CALLBACK: DWORD ThreadProc ( LPVOID lpParameter )
> >
> > Then a callback maker:
> >
> > :  ( -- alien )
> > [ ] comparer ; <-replace [ ] with your code
> >
> > Then call it:
> >
> > f 1024  f 0 1234 CreateThread
>
>   Thank you very much, Björn, that's exactly the kind of help I need right
> now.
>   Unfortunately, pasting your code in the Listener hangs it for some
> reason.
>
>   I have changed the  so that it would sit just there in the
> new thread:
>
> :  ( -- alien )
> [ t ] [ ] while 0 ; ! 0 is the return value, otherwise stack checker
> complains.
>
>   In the Process Monitor I see 100% CPU utilization in the main Factor.exe
> thread, and I see no additional thread created.
>   What might be the problem?
>
> Factor 0.98 x86.32 (1769, heads/master-6b77c4f3da, Tue May 10 15:22:01
> 2016)
> [Microsoft Visual C++ 190023506] on windows XP Pro SP3
>
> ---=---
>  Александр
>
>
> --
> 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
>
--
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


Re: [Factor-talk] Issue #1573: interrupt a tight loop

2016-05-27 Thread Alexander Ilin


27.05.2016, 12:56, "Björn Lindqvist" :
> Yes. See 
> https://github.com/bjourne/playground-factor/wiki/Tips-and-Tricks-Alien#using-alien-callbacks
> for an example on how to pass callbacks to c functions.

> So if CreateThread has signature:
>
> FUNCTION: HANDLE CreateThread ( LPSECURITY_ATTRIBUTES lpThreadAttributes,
> SIZE_T dwStackSize,
> LPVOID lpStartAddress,
> LPVOID lpParameter,
> DWORD dwCreationFlags,
> LPDWORD lpThreadId )
>
> You need to declare a callback:
>
> CALLBACK: DWORD ThreadProc ( LPVOID lpParameter )
>
> Then a callback maker:
>
> :  ( -- alien )
> [ ] comparer ; <-replace [ ] with your code
>
> Then call it:
>
> f 1024  f 0 1234 CreateThread

  Thank you very much, Björn, that's exactly the kind of help I need right now.
  Unfortunately, pasting your code in the Listener hangs it for some reason.

  I have changed the  so that it would sit just there in the new 
thread:

:  ( -- alien )
[ t ] [ ] while 0 ; ! 0 is the return value, otherwise stack checker 
complains.

  In the Process Monitor I see 100% CPU utilization in the main Factor.exe 
thread, and I see no additional thread created.
  What might be the problem?

Factor 0.98 x86.32 (1769, heads/master-6b77c4f3da, Tue May 10 15:22:01 2016)
[Microsoft Visual C++ 190023506] on windows XP Pro SP3

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

--
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


Re: [Factor-talk] Issue #1573: interrupt a tight loop

2016-05-27 Thread Björn Lindqvist
Hi,

>   OK, good. When I call CreateThread, one of the parameters I need to pass it 
> is a function pointer to the code which will run in the new thread. My 
> question is: can I pass a Factor quotation or a word as the function pointer? 
> Or is there some wrapper to make it possible, like with-new-vm or something?
>

Yes. See 
https://github.com/bjourne/playground-factor/wiki/Tips-and-Tricks-Alien#using-alien-callbacks
for an example on how to pass callbacks to c functions. So if
CreateThread has signature:

FUNCTION: HANDLE CreateThread ( LPSECURITY_ATTRIBUTES lpThreadAttributes,
SIZE_T dwStackSize,
LPVOID lpStartAddress,
LPVOID lpParameter,
DWORD dwCreationFlags,
LPDWORD lpThreadId )

You need to declare a callback:

CALLBACK: DWORD ThreadProc ( LPVOID lpParameter )

Then a callback maker:

:  ( -- alien )
[ ] comparer ;  <-replace [ ] with your code

Then call it:

f 1024  f 0 1234 CreateThread


-- 
mvh/best regards Björn Lindqvist

--
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


Re: [Factor-talk] Issue #1573: interrupt a tight loop

2016-05-27 Thread Alexander Ilin
Hello!

27.05.2016, 02:48, "Björn Lindqvist" :
> You could certainly wrap the CreateThread function and call it from
> factor. See the windows.kernel32 vocab for how wrapping Windows system
> functions are done.

  OK, good. When I call CreateThread, one of the parameters I need to pass it 
is a function pointer to the code which will run in the new thread. My question 
is: can I pass a Factor quotation or a word as the function pointer? Or is 
there some wrapper to make it possible, like with-new-vm or something?

> On the VM:s level, threads are started with the start_thread() function which 
> is defined in vm/os-windows.cpp.

  Good, thank you.

> Oh, and didn't we discuss this issue last year?

  We sure did, but you guys left me hanging. Nobody reacted to my suggestion 
and I did not get the help I needed, so I'm making a second attempt at fixing 
it now. This time I feel more confident I can do it with little supervision.

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

--
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