How practical is it to make jqt thread safe? Even just slapping a big mutex over everything? Is qt itself not threadsafe, or just jqt?

On Wed, 11 May 2022, bill lam wrote:

Jqt isn't thread safe. You should call to jqt from the main thread only.

I am also unsure if calling smoutput or other interactions with jqt session
from JE user thread is safe or not. echo or smoutput in jconsole session is
ok.

You can try using jpeg or png addon to read image. Please let me know if
these addons failed.

On Wed, 11 May 2022 at 8:14 AM Devon McCormick <devon...@gmail.com> wrote:

It's the "read_image_" line that seems to be where it hangs up for me, on
the fourth line from the end with the comment "¡Fails here!".
The invocation (for 5 threads) is:
mtFileWork t. '' MUTEX [ mtFileWork t. '' MUTEX [ mtFileWork t. '' MUTEX [
mtFileWork t. '' MUTEX [ mtFileWork t. '' MUTEX

On Tue, May 10, 2022 at 6:22 PM Henry Rich <henryhr...@gmail.com> wrote:

> What do I run to make it fail?
>
> Henry Rich
>
> On 5/10/2022 6:01 PM, Devon McCormick wrote:
> > Henry,
> > Here is the MVF - minimum viable failure.  It looks like the culprit is
> > "read_image" which is just a cover for "readimg_jqtide_".  I'm running
> > under jconsole.
> >
> > Set up in a directory with some .JPG files:
> >     FLS=: 0{"1 dir '*.jpg'
> >     createThreads 5
> >     MUTEX=: 10 T. 1    NB. Recursive mutex; either fails.
> >
> > mtFileWork=: 3 : 0
> >     tm=. 6!:1''
> >     while. 0<#FLS do.
> >         tn=. ":3 T. ''                   NB. Thread number as char
> >         varnm=. ' '-.~'threadVar',tn
> >         smoutput 'Thread ',tn,' locking at ',":qts''
> >         11 T. y
> >         smoutput 'Thread ',tn,' locked at ',":qts''
> >         (varnm,' FLS')=: split FLS
> >         smoutput 'Thread ',tn,' unlocking at ',(":qts''),' for file
> ',flnm=.
> >> ".varnm
> >         13 T. y
> >         smoutput 'Thread ',tn,' unlocked at ',":qts''
> >         #read_image flnm   NB. ¡Fails here!
> >      end.
> >      tm=. tm,~6!:1''
> > NB.EG mtFileWork t. '' MUTEX [ mtFileWork t. '' MUTEX [ mtFileWork t.
''
> > MUTEX [ mtFileWork t. '' MUTEX [ mtFileWork t. '' MUTEX
> > )
> >
> > Any help is appreciated!
> >
> > Thanks,
> >
> > Devon
> >
> > On Tue, May 10, 2022 at 4:46 PM Henry Rich <henryhr...@gmail.com>
wrote:
> >
> >> If you can get me a version that fails on Windows I'll look at it.
> >>
> >> Henry Rich
> >>
> >> On 5/10/2022 4:20 PM, Devon McCormick wrote:
> >>> Hi,
> >>>
> >>> Has anyone had success using the multi-threading mutex primitives?
> I've
> >>> had limited success - I'll be presenting some basic routines at
NYCJUG
> >> this
> >>> evening (18:00 EDT -
> >>> https://www.meetup.com/J-Dynamic-Functional-Programming/) - but have
> >> been
> >>> unable to run multiple threads on a real-life process without
crashing
> J.
> >>>
> >>> The following simplified demo seems to work OK but the version of
this
> >>> where I do actual work crashes - with "Process shell<1> exited
> abnormally
> >>> with code 5" -  after two to thirty repetitions.
> >>>
> >>>      MUTEX=: 10 T. 0    NB. Fast mutex
> >>>      createThreads=: 3 : '{{ 0 T. '''' }} ^:y]'''''
> >>>      qts=: 6!:0
> >>>      createThreads 5
> >>>      GVAR=: 100?@$1e6                    NB. Initialize global
threads
> >> will
> >>> consume
> >>>
> >>> multiLockMsgUnlock=: 3 : 0
> >>>      while. 0<#GVAR do.
> >>>          tn=. ":3 T. ''                   NB. Thread number as char
> >>>          varnm=: ' '-.~'threadVar',tn
> >>>          smoutput 'Thread ',tn,' locking at ',":qts''
> >>>          11 T. y
> >>>          smoutput 'Thread ',tn,' locked at ',":qts''
> >>>          (varnm,' GVAR')=: split GVAR
> >>>          smoutput 'Thread ',tn,' unlocking at ',(":qts''),' with
> >>> ',tn,'=',":".varnm
> >>>          13 T. y
> >>>          smoutput 'Thread ',tn,' unlocked at ',(":qts''),';
> >> #GVAR=',":#GVAR
> >>>       end.
> >>> )
> >>> NB. Start five processes (one line):
> >>> multiLockMsgUnlock t. '' MUTEX [ multiLockMsgUnlock t. '' MUTEX [
> >>> multiLockMsgUnlock t. '' MUTEX [ multiLockMsgUnlock t. '' MUTEX [
> >>> multiLockMsgUnlock t. '' MUTEX
> >>>
> >>> The actual work I'm doing is on files, a list of whose names
> corresponds
> >> to
> >>> the GVAR vector above.
> >>>
> >>> Any suggestions are welcome.
> >>>
> >>> Cheers,
> >>>
> >>> Devon
> >>>
> >>
> >> --
> >> This email has been checked for viruses by AVG.
> >> https://www.avg.com
> >>
> >> ----------------------------------------------------------------------
> >> For information about J forums see
http://www.jsoftware.com/forums.htm
> >>
> >
>
>
> --
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


--

Devon McCormick, CFA

Quantitative Consultant
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to