On Wed, 17 Jun 2009, Angel Pais wrote:
> Program:
> proc main()
> set alternate to test.txt
> set alternate on
>       dbCreate( "_tst", { { "F","C",10,0 } } )
>       use _tst alias "tst1" new shared
>       dbRelease()
>       use _tst alias "tst1" new shared
>       WorkSpaceEval( {|| doTest() } )
>    return
>    proc doTest()
>       local i, n
>       n := select()
>       ? "Current workarea: ", ltrim( str( n ) ), "alias:", alias(), ;
>         "(verify:" + ltrim( str( select( alias() ) ) ) + ")"
>       ? "All active workareas in thread workspace:"
>       for i := 1 to 255
>          select( i )
>          if used()
>             ? "   workarea:", ltrim( str( i ) ), "alias:", alias()
>          endif
>       next
>       select( n )
>    return
> Output:
> Current workarea:  1 alias: TST1 (verify:1)
> All active workareas in thread workspace:
>    workarea: 1 alias: TST1
> Current workarea:  2 alias:  (verify:0)
> All active workareas in thread workspace:
>    workarea: 1 alias: TST1
> Current workarea:  7 alias:  (verify:0)
> All active workareas in thread workspace:
>    workarea: 1 alias: TST1
> Current workarea:  183 alias:  (verify:0)
> All active workareas in thread workspace:
>    workarea: 1 alias: TST1

Thank you. The same results as Pritpal's ones.
Can some xbase++ guru explain why doTest() is executed more then once?

Anyhow I wanted to tests sth different. Please try this code:

   proc main()
      set alternate to test.txt
      set alternate on
      dbCreate( "_tst", { { "F","C",10,0 } } )
      use _tst alias "tst1" new shared
      dbRelease()
      WorkSpaceEval( {|| doTest() }, 2 )
      use _tst alias "tst1" new shared
      WorkSpaceEval( {|| doTest() }, 2 )
      wait
   return
   proc doTest()
      local i, n
      n := select()
      ? "Current workarea: ", ltrim( str( n ) ), "alias:", alias(), ;
        "(verify:" + ltrim( str( select( alias() ) ) ) + ")", ;
        "used:", used()
      ? "All active workareas in thread workspace:"
      for i := 1 to 255
         select( i )
         if used()
            ? "   workarea:", ltrim( str( i ) ), "alias:", alias()
         endif
      next
      ? "ZeroSpaceList: "
      aeval( WorkSpaceList( 2 ), {|x| qqout( "[" + x + "] " ) } )
      ? "WorkSpaceList: "
      aeval( WorkSpaceList( 1 ), {|x| qqout( "[" + x + "] " ) } )
      ?
      select( n )
   return

and also if possible what happens when user tries to make sth like:

   proc main()
      dbCreate( "_tst", { { "F","C",10,0 } } )
      use _tst alias "tst1" new shared
      dbRelease()
      WorkSpaceEval( {|| dbRelease() }, 2 )
      wait
   return

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to