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

Reply via email to