Thanks, John!
 
This code compiles:
: <ThreadProc> ( -- alien )
   [ [ t ] [ ] while ] ThreadProc ;
 
: start-thread ( -- hnd )
f 1024 <ThreadProc> 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 <alien> or something?
 
27.05.2016, 16:52, "John Benediktsson" <mrj...@gmail.com>:
Note, your <ThreadProc> needs to use the name of the Callback (in this case "ThreadProc") I think:
 
: <ThreadProc>
    [ ] ThreadProc ;
 
 
 
On Fri, May 27, 2016 at 6:47 AM, Alexander Ilin <ajs...@yandex.ru> wrote:

 
27.05.2016, 12:56, "Björn Lindqvist" <bjou...@gmail.com>:
> 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:
>
> : <ThreadProc> ( -- alien )
>     [ ] comparer ; <-replace [ ] with your code
>
> Then call it:
>
>     f 1024 <ThreadProc> 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 <ThreadProc> so that it would sit just there in the new thread:

: <ThreadProc> ( -- 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

Reply via email to