Re: [Factor-talk] db.tuples in threads

2017-12-29 Thread Alexander Ilin
Hello!

  I have figured out what the issue with `no-defined-persistent` was.
  Turns out I called `object ensure-table` instead of `object class-of 
ensure-table`.

29.12.2017, 02:45, "Alexander Ilin" :
> Understood, thank you, Chris!
>
> In the end I used a promise, which is almost the same thing.
>
> I have another question, though.
>
> Is it possible to use the facilities offered by the db.tuples vocab from 
> within a thread?
>
> When I try to call `ensure-table`, I get the `no-defined-persistent` 
> exception, even if I call `define-persistent` on the same class earlier in 
> the same thread.
>
> Is this a principal limitation, or it should be possible and I'm doing 
> something wrong? I can post a minimal example code if it helps.
>
> 21.12.2017, 01:44, "Chris Double" :
>>  The easiest way might be to use futures:
>>  http://docs.factorcode.org/content/article-concurrency.futures.html
>>
>>  eg:
>>
>>  [ 42 ] future ?future .
>>  => 42
>>
>>  On Thu, Dec 21, 2017 at 10:44 AM, Alexander Ilin  wrote:
>>>   Hello!
>>>
>>> If I spawn a thread using the threads:spawn word, is there a way to 
>>> wait for the thread to finish its work?
>>> I need something like WaitForSingleObject(ThreadHandle, INFINITE).
>
> ---=---
>  Александр
>
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk

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

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] db.tuples in threads

2017-12-28 Thread Alexander Ilin
Understood, thank you, Chris!

In the end I used a promise, which is almost the same thing.

I have another question, though.

Is it possible to use the facilities offered by the db.tuples vocab from within 
a thread?

When I try to call `ensure-table`, I get the `no-defined-persistent` exception, 
even if I call `define-persistent` on the same class earlier in the same thread.

Is this a principal limitation, or it should be possible and I'm doing 
something wrong? I can post a minimal example code if it helps.

21.12.2017, 01:44, "Chris Double" :
> The easiest way might be to use futures:
> http://docs.factorcode.org/content/article-concurrency.futures.html
>
> eg:
>
> [ 42 ] future ?future .
> => 42
>
> On Thu, Dec 21, 2017 at 10:44 AM, Alexander Ilin  wrote:
>>  Hello!
>>
>>    If I spawn a thread using the threads:spawn word, is there a way to wait 
>> for the thread to finish its work?
>>    I need something like WaitForSingleObject(ThreadHandle, INFINITE).

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

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk