help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wrapper to use a C++ class in Octave


From: Stefan Oltmanns
Subject: Re: Wrapper to use a C++ class in Octave
Date: Sat, 12 Aug 2017 17:34:47 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

Am 12.08.2017 um 17:23 schrieb Carlo De Falco:
> 
>> On 10 Aug 2017, at 19:21, Mike Miller <address@hidden> wrote:
>>
>> On Wed, Aug 09, 2017 at 23:40:49 +0200, Stefan Oltmanns wrote:
>>> The class is designed for non blocking operation and everything is done
>>> by a background thread (when result is ready the callback function is
>>> called).
>>>
>>> Is there a simple way to write a wrapper around the class? Is there any
>>> example where something like this has been done?
>>
>> This is certainly doable and has been done before. I can't say if you'll
>> call it simple. Take a look at Octave's own audioplayer and
>> audiorecorder classes, which have options to call user functions when
>> the audio driver needs data or has data ready.
>>
>>  
>> https://hg.savannah.gnu.org/hgweb/octave/file/@/libinterp/dldfcn/audiodevinfo.cc
> 
> Another example of this in Octave sources could be the implementation of 
> ode15i 
> as a wrapper to the sundials IDA library:
> 
>   
> http://hg.savannah.gnu.org/hgweb/octave/file/c3cfd3115b78/libinterp/dldfcn/__ode15__.cc
> 
> The most simple example of storing and calling an Octave function from a C++ 
> program 
> is in the examples ditributed with Octave sources:
> 
>   
> http://hg.savannah.gnu.org/hgweb/octave/file/c3cfd3115b78/examples/code/funcdemo.cc
> 
> HTH,
> c.
> 

I think there is one major problem: The class is multithreaded and the
callbacks are called from another thread. According to the infos I found
Octave is not thread-safe, so the callbacks have to be handled inside
the C++ code, right?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]