Author Topic: How to achieve multi-threaded with (V)LISP?  (Read 11416 times)

0 Members and 1 Guest are viewing this topic.

jxphklibin

  • Guest
How to achieve multi-threaded with (V)LISP?
« on: August 16, 2009, 03:41:45 AM »
Hello all.

How to achieve multi-threaded with (V)LISP?

Demonstration of the effect as follows:
« Last Edit: August 20, 2009, 04:38:08 AM by Leeben »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: How to achieve multi-threaded with (V)LISP?
« Reply #1 on: August 16, 2009, 04:32:14 AM »

To my knowledge, multi-threading is not possible .. ie  threads are not able to execute independently.

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Lee Mac

  • Seagull
  • Posts: 12920
  • London, England
Re: How to achieve multi-threaded with (V)LISP?
« Reply #2 on: August 16, 2009, 08:22:45 AM »
Why not just use an action_tile statement that will update the other tile with the $value retrieved from that tile?

Lee Mac

  • Seagull
  • Posts: 12920
  • London, England
Re: How to achieve multi-threaded with (V)LISP?
« Reply #3 on: August 16, 2009, 08:32:21 AM »
This is the closest I could get:

Code: [Select]
test : dialog {
label = "Test";
  spacer_1;
  : text { label = "Edit Box 1: "; alignment = centered; }
  : edit_box { key = "ed_1"; edit_width = 12; alignment = centered; fixed_width = true; }
  spacer_1;
  : text { label = "Edit Box 2: "; alignment = centered; }
  : edit_box { key = "ed_2"; edit_width = 12; alignment = centered; fixed_width = true; }
  ok_cancel;
} // dialog

Code: [Select]
(defun c:test (/ dcTag)
  (vl-load-com)
 
  (cond ((<= (setq dcTag (load_dialog "test.dcl")) 0)
         (princ "\n** Error Loading DCL file **"))
        ((not (new_dialog "test" dcTag))
         (princ "** Error Loading Dialog **"))

        (t

         (action_tile "ed_1" "(set_tile \"ed_2\" $value)")
         (action_tile "ed_2" "(set_tile \"ed_1\" $value)")
         (action_tile "accept" "(done_dialog)")
         (action_tile "cancel" "(done_dialog)")

         (start_dialog)
         (unload_dialog dcTag)))

  (princ))

cjw

  • Guest
Re: How to achieve multi-threaded with (V)LISP?
« Reply #4 on: August 20, 2009, 02:04:32 AM »

To my knowledge, multi-threading is not possible .. ie  threads are not able to execute independently.


I have no idea too...
But it real work...so amazing.
See the link
http://www.mjtd.com/BBS/dispbbs.asp?boardID=3&ID=77391&page=1



Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: How to achieve multi-threaded with (V)LISP?
« Reply #5 on: August 20, 2009, 03:17:23 AM »
I'd need to see the code to see  the trick.
The site you point to does not allow downloads untill 10 posts are made .....

please answer : if you have the  the program to do this, why do you ask questions about how to do it. ??


I say again : Lisp is not capable of multitasking.

/// kdub
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

pkohut

  • Guest
Re: How to achieve multi-threaded with (V)LISP?
« Reply #6 on: August 20, 2009, 03:30:43 AM »
I'd need to see the code to see  the trick.
The site you point to does not allow downloads untill 10 posts are made .....

please answer : if you have the  the program to do this, why do you ask questions about how to do it. ??


I say again : Lisp is not capable of multitasking.

/// kdub

I went through each message one by one, and it appears to be an exploit of a bug in 2004.  There also seems to be chatter
about an exploit in DCL by purposely causing an exception and catching it, do some work, and repeat, which causes
the appearance of multi theading.

Here are 2 messages about the bug exploit in 2004.

Quote
In fact, the single-threaded Lisp with the CPU's working principle is very similar, because at any moment, a CPU can only handle data, but because the distribution of the operating system, so that CPU can quickly switch between multiple tasks, looks like a number of tasks at the same time. Lisp is running on a thread under the CAD, can not give directions to the operating system (at least there is no direct method), it can only be single-threaded, and in the use of CAD2004 when Grread, as long as the cycle by adding the words (command "_ . zoom "...), the mouse and keyboard, even if there is no action, as long as the implementation of the sentence, Lisp would be that there had been a mouse operation, allows continuous cycle. Lisp This is a bug, but the preparation of CAD is much need for the game, but unfortunately this bug has been little in the CAD2007 corrected, must be "work space" to open and horizontal bar placed before a row. To make matters worse to CAD2008, this bug has been completely corrected, in any case can not be continuous.

Quote
The effect of the yen is very unusual move, it is refreshing, it is required for the game. Lisp contact soon, would like to achieve this effect, no result, and later on can not do that Lisp was a great defect. Was occasionally encountered a bug plus a Grread enables multi-threaded, but are restricted versions.

I first take a look at what it achieved.


Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: How to achieve multi-threaded with (V)LISP?
« Reply #7 on: August 20, 2009, 04:07:43 AM »
Thanks Paul,
That's the gist of what I got from it too.

I don't know anyone developing for AC2004, so cant ask  anyone ... :)


ps:
came back to add a treatise on the wisdom of developing software based on a bug ... but thought better of it.

« Last Edit: August 20, 2009, 04:11:22 AM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8753
  • AKA Daniel
Re: How to achieve multi-threaded with (V)LISP?
« Reply #8 on: August 20, 2009, 05:36:02 AM »
I thought it might have been some sort of reactor.

pkohut

  • Guest
Re: How to achieve multi-threaded with (V)LISP?
« Reply #9 on: August 20, 2009, 06:55:39 AM »
I thought it might have been some sort of reactor.

I don't know?  For the DCL one it was mentioned that it only worked for modeless
dialogs.

cjw

  • Guest
Re: How to achieve multi-threaded with (V)LISP?
« Reply #10 on: August 20, 2009, 08:39:11 AM »
I'd need to see the code to see  the trick.
The site you point to does not allow downloads untill 10 posts are made .....

please answer : if you have the  the program to do this, why do you ask questions about how to do it. ??


I say again : Lisp is not capable of multitasking.

/// kdub
First,I agree with you.Lisp is not capable of multitasking.

I don't have the program.
I don't know how to do this.
so I ask the questions.
May be somebody here know how to do it...

cjw

  • Guest
Re: How to achieve multi-threaded with (V)LISP?
« Reply #11 on: August 20, 2009, 08:48:00 AM »
And the site I point which doesn't give the answer.
something download is not the core......


Code: [Select]
;From http://www.mjtd.com/BBS/dispbbs.asp?boardID=3&ID=77391&page=1
;nonsmall 作品: Visual DCL 对话框自动连接程序
;本代码全部由Visual DCL程序自动生成

(defun c:tt();此部分是测试代码用
    (Form1_load)
)

(defun Form1_load( / dcl_id Dialog_Return key keys Dcl_File)
    (vl-load-com)
    (setq dcl_id (load_dialog (setq Dcl_File (Write_Dcl))));对话框加载
    (vl-file-delete Dcl_File);加载后删除DCL文件
    (setq Dialog_Return 2)
    (while (> Dialog_Return 1) ;循环控制对话框是否结束
        (new_dialog "Form1" dcl_id);建立窗体
;-->-->-对话框初始化->-->--
        (setq keys '("test1" "test2" "Command1" "accept"));列表全部控件名称
        (foreach key keys;全部控件的初始化
            (if (eval (read (strcat key "_bak"))) (set_tile key (eval (read (strcat key "_bak")))));控件内容
            (action_tile key "(Action_Form1_Keys $key $value)");点击动作
        )
;--<--<-对话框初始化完成-<--<--
        (setq Dialog_Return (start_dialog));开启对话框(用户可见)
    )
    (unload_dialog dcl_id);退出时卸载对话框
    (princ);防止函数回显
)

(defun Action_Form1_Keys (key value) ;全部控件的点击动作触发
    (print (list key value))(print "*-------*");测试代码 用后删除
    (cond
        ((= key "accept") ;{确认按钮}
           
            (Get_Form1_Data)
            (done_dialog 1);对话框退出返回主函数 传递给Dialog_Return值为1
        )
        ((= key "cancel") ;{取消按钮}
           
            (done_dialog 0);对话框退出返回主函数 传递给Dialog_Return值为0
        )
        ((= key "test1") ; {"test1--》"} (按钮)
            ()
        )
        ((= key "test2") ; {"《--test2"} (按钮)
            ()
        )
        ((= key "Command1") ; {"签名"} (按钮)
            ()
        )
    )
)
(defun Get_Form1_Data( / key);临时生成Dcl文件 返回文件名
    (foreach key keys
        (set (read (strcat key "_bak")) (get_tile key));每个控件都赋给一个变量 用于下次开启初始化
    )
)
(defun Write_Dcl( / Dcl_File file str)
    (setq Dcl_File (vl-filename-mktemp nil nil ".Dcl"))
    (setq file (open Dcl_File "w"))
    (foreach str '(
        "/*nonsmall 作品: Visual DCL*/"
        "//本代码全部由Visual DCL程序自动生成"
        ""
        "Form1:dialog"
        "{"
        " label = \"多线程Lisp研究\";"
        "    :boxed_column"
        "    {"
        "     label = \"现在时间\" ;"
        "        :text"
        "        {"
        "            key = \"time\" ;"
        "            label = \"Label1\" ;"
        "            width = 34.95 ;"
        "            height = 1.275 ;"
        "        }"
        "    }"
        "    :boxed_column"
        "    {"
        "     label = \"文字信息\" ;"
        "        :text"
        "        {"
        "            key = \"txt\" ;"
        "            label = \"Label1\" ;"
        "            width = 36.15 ;"
        "            height = 1.875 ;"
        "        }"
        "    }"
        "    :row"
        "    {"
        "        :button"
        "        {"
        "            key = \"test1\" ;"
        "            label = \"test1--》\" ;"
        "            width = 10.95 ;"
        "            height = 2.475 ;"
        "        }"
        "        :button"
        "        {"
        "            key = \"test2\" ;"
        "            label = \"《--test2\" ;"
        "            width = 12.15 ;"
        "            height = 2.475 ;"
        "        }"
        "        :button"
        "        {"
        "            key = \"Command1\" ;"
        "            label = \"签名\" ;"
        "            width = 12.15 ;"
        "            height = 2.475 ;"
        "        }"
        "    }"
        "    :button"
        "    {"
        "        key = \"accept\" ;"
        "        label = \"Ok\" ;"
        "        width = 37.35 ;"
        "        height = 2.475 ;"
        "        is_default = true ;"
        "    }"
        "}"
        )
    (write-line str file))
    (close file)
    Dcl_File
)

Code: [Select]
;;http://www.theswamp.org/index.php?action=post;topic=29905.0;num_replies=10
;nonsmall 作品: Visual DCL 对话框自动连接程序
;本代码全部由Visual DCL程序自动生成

(defun c:tt();此部分是测试代码用
    (Form1_load)
)

(defun Form1_load( / dcl_id Dialog_Return key keys Dcl_File)
    (vl-load-com)
    (setq dcl_id (load_dialog (setq Dcl_File (Write_Dcl))));对话框加载
    (vl-file-delete Dcl_File);加载后删除DCL文件
    (setq Dialog_Return 2)
    (while (> Dialog_Return 1) ;循环控制对话框是否结束
        (new_dialog "Form1" dcl_id);建立窗体
;-->-->-对话框初始化->-->--
        (setq keys '("Image2" "Image1" "Command1" "Command2" "Command3" "Command4" "Command5" "Command6" "accept" "cancel"));列表全部控件名称
        (start_image "Image2");图像 {"Image2"} 初始化
        (fill_image 0 0 (dimx_tile "Image2") (dimy_tile "Image2") 0);图像填充黑色背景
        (slide_image 0 0 (dimx_tile "Image2") (dimy_tile "Image2") "");图像显示SLD幻灯片
        (end_image)
       
        (start_image "Image1");图像 {"Image1"} 初始化
        (fill_image 0 0 (dimx_tile "Image1") (dimy_tile "Image1") 0);图像填充黑色背景
        (slide_image 0 0 (dimx_tile "Image1") (dimy_tile "Image1") "");图像显示SLD幻灯片
        (end_image)
       
        (foreach key keys;全部控件的初始化
            (if (eval (read (strcat key "_bak"))) (set_tile key (eval (read (strcat key "_bak")))));控件内容
            (action_tile key "(Action_Form1_Keys $key $value)");点击动作
        )
;--<--<-对话框初始化完成-<--<--
        (setq Dialog_Return (start_dialog));开启对话框(用户可见)
    )
    (unload_dialog dcl_id);退出时卸载对话框
    (princ);防止函数回显
)

(defun Action_Form1_Keys (key value) ;全部控件的点击动作触发
    (print (list key value))(print "*-------*");测试代码 用后删除
    (cond
        ((= key "accept") ;{确认按钮}
           
            (Get_Form1_Data)
            (done_dialog 1);对话框退出返回主函数 传递给Dialog_Return值为1
        )
        ((= key "cancel") ;{取消按钮}
           
            (done_dialog 0);对话框退出返回主函数 传递给Dialog_Return值为0
        )
        ((= key "Image2") ; {} (图像按钮)
            ()
        )
        ((= key "Image1") ; {} (图像按钮)
            ()
        )
        ((= key "Command1") ; {"播放"} (按钮)
            ()
        )
        ((= key "Command2") ; {"停止"} (按钮)
            ()
        )
        ((= key "Command3") ; {"加速"} (按钮)
            ()
        )
        ((= key "Command4") ; {"减速"} (按钮)
            ()
        )
        ((= key "Command5") ; {"我的原创作品空间:nonsmall.ys168.com"} (按钮)
            ()
        )
        ((= key "Command6") ; {"QQ: 43797405 Email:nonsmall@163.com"} (按钮)
            ()
        )
    )
)
(defun Get_Form1_Data( / key);临时生成Dcl文件 返回文件名
    (foreach key keys
        (set (read (strcat key "_bak")) (get_tile key));每个控件都赋给一个变量 用于下次开启初始化
    )
)
(defun Write_Dcl( / Dcl_File file str)
    (setq Dcl_File (vl-filename-mktemp nil nil ".Dcl"))
    (setq file (open Dcl_File "w"))
    (foreach str '(
        "/*nonsmall 作品: Visual DCL*/"
        "//本代码全部由Visual DCL程序自动生成"
        ""
        "Form1:dialog"
        "{"
        " label = \"VLisp+DCL创新动态幻灯片播放(GIF效果)\";"
        "    :text"
        "    {"
        "        key = \"name\" ;"
        "        label = \"nonsmall(不死猫原创作品)\" ;"
        "        width = 46.95 ;"
        "        height = 1.275 ;"
        "    }"
        "    :row"
        "    {"
        "        :text"
        "        {"
        "            key = \"time\" ;"
        "            label = \"当前时间\" ;"
        "            width = 38.55 ;"
        "            height = 1.275 ;"
        "        }"
        "        :image"
        "        {"
        "            key = \"Image2\" ;"
        "            width = 7.35 ;"
        "            height = 1.875 ;"
        "        }"
        "    }"
        "    :boxed_column"
        "    {"
        "     label = \"可调速度动态幻灯片放映\" ;"
        "        :image"
        "        {"
        "            key = \"Image1\" ;"
        "            width = 37.35 ;"
        "            height = 17.475 ;"
        "        }"
        "        :row"
        "        {"
        "            :button"
        "            {"
        "                key = \"Command1\" ;"
        "                label = \"播放\" ;"
        "                width = 8.55 ;"
        "                height = 3.675 ;"
        "            }"
        "            :button"
        "            {"
        "                key = \"Command2\" ;"
        "                label = \"停止\" ;"
        "                width = 8.55 ;"
        "                height = 3.675 ;"
        "            }"
        "            :button"
        "            {"
        "                key = \"Command3\" ;"
        "                label = \"加速\" ;"
        "                width = 8.55 ;"
        "                height = 3.675 ;"
        "            }"
        "            :button"
        "            {"
        "                key = \"Command4\" ;"
        "                label = \"减速\" ;"
        "                width = 8.55 ;"
        "                height = 3.675 ;"
        "            }"
        "        }"
        "    }"
        "    :button"
        "    {"
        "        key = \"Command5\" ;"
        "        label = \"我的原创作品空间:nonsmall.ys168.com\" ;"
        "        width = 46.95 ;"
        "        height = 1.875 ;"
        "    }"
        "    :button"
        "    {"
        "        key = \"Command6\" ;"
        "        label = \"QQ: 43797405 Email:nonsmall@163.com\" ;"
        "        width = 46.95 ;"
        "        height = 1.875 ;"
        "    }"
        "ok_cancel ;"
        "}"
        )
    (write-line str file))
    (close file)
    Dcl_File
)

Code: [Select]
;;http://www.theswamp.org/index.php?action=post;topic=29905.0;num_replies=10
;nonsmall 作品: Visual DCL 对话框自动连接程序
;本代码全部由Visual DCL程序自动生成

(defun C:TT () ;此部分是测试代码用
  (FORM1_LOAD)
)

(defun FORM1_LOAD (/ DCL_ID DIALOG_RETURN KEY KEYS DCL_FILE)
  (vl-load-com)
  (setq DCL_ID (load_dialog (setq DCL_FILE (WRITE_DCL)))) ;对话框加载
  (vl-file-delete DCL_FILE) ;加载后删除DCL文件
  (setq DIALOG_RETURN 2)
  (while (> DIALOG_RETURN 1) ;循环控制对话框是否结束
    (new_dialog "Form1" DCL_ID) ;建立窗体
;-->-->-对话框初始化->-->--
    (setq KEYS '("Stop" "Begin" "Command1" "accept" "Text1" "Text2"))
;列表全部控件名称
    (foreach KEY KEYS ;全部控件的初始化
      (if (eval (read (strcat KEY "_bak")))
(set_tile KEY (eval (read (strcat KEY "_bak"))))
      ) ;控件内容
      (action_tile KEY "(Action_Form1_Keys $key $value)") ;点击动作
    )
;--<--<-对话框初始化完成-<--<--
    (setq DIALOG_RETURN (start_dialog)) ;开启对话框(用户可见)
  )
  (unload_dialog DCL_ID) ;退出时卸载对话框
  (princ) ;防止函数回显
)

(defun ACTION_FORM1_KEYS (KEY VALUE) ;全部控件的点击动作触发
  (print (list KEY VALUE))
  (print "*-------*") ;测试代码 用后删除
  (cond
    ((= KEY "accept") ;{确认按钮}

     (GET_FORM1_DATA)
     (done_dialog 1) ;对话框退出返回主函数 传递给Dialog_Return值为1
    )
    ((= KEY "cancel") ;{取消按钮}

     (done_dialog 0) ;对话框退出返回主函数 传递给Dialog_Return值为0
    )
    ((= KEY "Stop") ; {"Stop--》"} (按钮)
     ()
    )
    ((= KEY "Begin") ; {"《--Begin"} (按钮)
     ()
    )
    ((= KEY "Command1") ; {"签名"} (按钮)
     ()
    )
  )
)
(defun GET_FORM1_DATA (/ KEY) ;临时生成Dcl文件 返回文件名
  (foreach KEY KEYS
    (set (read (strcat KEY "_bak")) (get_tile KEY))
;每个控件都赋给一个变量 用于下次开启初始化
  )
)
(defun WRITE_DCL (/ DCL_FILE FILE STR)
  (setq DCL_FILE (vl-filename-mktemp NIL NIL ".Dcl"))
  (setq FILE (open DCL_FILE "w"))
  (foreach STR '("/*nonsmall 作品: Visual DCL*/"
"//本代码全部由Visual DCL程序自动生成"
""
"Form1:dialog"
"{"
" label = \"多线程Lisp研究\";"
"    :row"
"    {"
"        :column"
"        {"
"            :boxed_column"
"            {"
"             label = \"现在时间\" ;"
"                :text"
"                {"
"                    key = \"time\" ;"
"                    label = \"Label1\" ;"
"                    width = 33.75 ;"
"                    height = 1.275 ;"
"                }"
"            }"
"            :boxed_column"
"            {"
"             label = \"文字信息\" ;"
"                :text"
"                {"
"                    key = \"txt\" ;"
"                    label = \"Label1\" ;"
"                    width = 34.95 ;"
"                    height = 1.875 ;"
"                }"
"            }"
"            :row"
"            {"
"                :button"
"                {"
"                    key = \"Stop\" ;"
"                    label = \"Stop--》\" ;"
"                    width = 10.95 ;"
"                    height = 2.475 ;"
"                }"
"                :button"
"                {"
"                    key = \"Begin\" ;"
"                    label = \"《--Begin\" ;"
"                    width = 12.15 ;"
"                    height = 2.475 ;"
"                }"
"                :button"
"                {"
"                    key = \"Command1\" ;"
"                    label = \"签名\" ;"
"                    width = 12.15 ;"
"                    height = 2.475 ;"
"                }"
"            }"
"            :button"
"            {"
"                key = \"accept\" ;"
"                label = \"Ok\" ;"
"                width = 37.35 ;"
"                height = 2.475 ;"
"                is_default = true ;"
"            }"
"        }"
"        :boxed_column"
"        {"
"         label = \"动态输入感知\" ;"
"            :edit_box"
"            {"
"                key = \"Text1\" ;"
"                width = 18.15 ;"
"                height = 0.675 ;"
"            }"
"            :text"
"            {"
"                key = \"Label1\" ;"
"                label = \"输入内容为:\" ;"
"                width = 18.15 ;"
"                height = 1.275 ;"
"            }"
"            :edit_box"
"            {"
"                key = \"Text2\" ;"
"                width = 18.15 ;"
"                height = 0.675 ;"
"            }"
"            :text"
"            {"
"                key = \"Label2\" ;"
"                width = 18.15 ;"
"                height = 5.475 ;"
"            }"
"        }"
"    }"
"}"
)
    (write-line STR FILE)
  )
  (close FILE)
  DCL_FILE
)
 ;|
/*   自动备份FRM文件内容
VERSION 5.00
Begin VB.Form Form1
   Caption         =   "多线程Lisp研究"
   ClientHeight    =   2895
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6075
   LinkTopic       =   "Form1"
   ScaleHeight     =   2895
   ScaleWidth      =   6075
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame3
      Caption         =   "动态输入感知"
      Height          =   2655
      Left            =   3960
      TabIndex        =   8
      Top             =   120
      Width           =   2055
      Begin VB.TextBox Text2
         Height          =   270
         Left            =   120
         TabIndex        =   11
         Top             =   1080
         Width           =   1815
      End
      Begin VB.TextBox Text1
         Height          =   270
         Left            =   120
         TabIndex        =   9
         Top             =   360
         Width           =   1815
      End
      Begin VB.Label Label2
         Height          =   1095
         Left            =   120
         TabIndex        =   12
         Top             =   1440
         Width           =   1815
      End
      Begin VB.Label Label1
         Caption         =   "输入内容为:"
         Height          =   255
         Left            =   120
         TabIndex        =   10
         Top             =   720
         Width           =   1815
      End
   End
   Begin VB.CommandButton Command1
      Caption         =   "签名"
      Height          =   495
      Left            =   2640
      TabIndex        =   7
      Top             =   1680
      Width           =   1215
   End
   Begin VB.Frame Frame2
      Caption         =   "现在时间"
      Height          =   735
      Left            =   120
      TabIndex        =   5
      Top             =   120
      Width           =   3735
      Begin VB.Label time
         Caption         =   "Label1"
         Height          =   255
         Left            =   120
         TabIndex        =   6
         Top             =   240
         Width           =   3375
      End
   End
   Begin VB.CommandButton Begin
      Caption         =   "《--Begin"
      Height          =   495
      Left            =   1320
      TabIndex        =   4
      Top             =   1680
      Width           =   1215
   End
   Begin VB.CommandButton Stop
      Caption         =   "Stop--》"
      Height          =   495
      Left            =   120
      TabIndex        =   3
      Top             =   1680
      Width           =   1095
   End
   Begin VB.CommandButton OK
      Caption         =   "Ok"
      Height          =   495
      Left            =   120
      TabIndex        =   2
      Top             =   2280
      Width           =   3735
   End
   Begin VB.Frame Frame1
      Caption         =   "文字信息"
      Height          =   735
      Left            =   120
      TabIndex        =   0
      Top             =   840
      Width           =   3735
      Begin VB.Label txt
         Caption         =   "Label1"
         Height          =   375
         Left            =   120
         TabIndex        =   1
         Top             =   240
         Width           =   3495
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
*/
|;



jxphklibin

  • Guest
Re: How to achieve multi-threaded with (V)LISP?
« Reply #12 on: August 20, 2009, 10:10:00 PM »
And the site I point which doesn't give the answer.
something download is not the core......


Code: [Select]
;From http://www.mjtd.com/BBS/dispbbs.asp?boardID=3&ID=77391&page=1
;nonsmall 作品: Visual DCL 对话框自动连接程序
;本代码全部由Visual DCL程序自动生成

......



Cjw, Thank you to add the codes!You are welcome!

nonsmall

  • Guest
Re: How to achieve multi-threaded with (V)LISP?
« Reply #13 on: April 20, 2010, 02:47:46 AM »
It is true,
From the demo,it is proved.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8753
  • AKA Daniel
Re: How to achieve multi-threaded with (V)LISP?
« Reply #14 on: April 20, 2010, 04:45:58 AM »
I wouldn't be hard to spawn threads  from lisp with the help of some external module.
here is a multithreaded sample with Bricscad  and .NET 4

Code: [Select]

    [LispFunction("pfunc")]
    public static ResultBuffer pfunc(ResultBuffer args)
    {
      var stv = new SynchronizedCollection<TypedValue>();
      var rb = new ResultBuffer();
      Parallel.For(0,Convert.ToInt32 (args[0].Value) , X =>
      {
        stv.Add(new TypedValue((short)LispDataType.Int32, foo(X)));
      });

      foreach (TypedValue v in stv)
        rb.Add(v);
      return rb;
    }

    static int foo(double r)
    {
      Thread.Sleep(1500);
      return  Thread.CurrentThread.ManagedThreadId; ;
    }