I don't know. It's bette to ask ridiculousfish about it.

Maxim

On Mon, 23 Jul 2012 01:33:13 +0800, Jan Kanis <j...@jankanis.nl> wrote:

> But now that fish is multithreaded, it's perhaps possible to execute
> background functions in a separate thread? Or is the main
> function-executing part of the new fish not multithreaded?
>
> On Sat, Jul 21, 2012 at 4:13 AM, Maxim Gonchar <gma...@gmail.com> wrote:
>
>> Hi,
>>
>> As far as I understand, since fish do not use subshells, but executes
>> functions in the same thread,
>> it can not run functions in the background.
>> I do not know, if there exist is a simple way to implement background
>> functions.
>>
>> A partial workaround is to run a new fish instance to simulate a real
>> subshell:
>> fish -c 'q 10s'&
>> fish -c 'q 3s' &
>>
>> Of course this way is a bit limiting: the subfish will 'see' only  
>> exported
>> and universal variables and only saved functions.
>>
>> Maxim
>>
>> On Sat, 21 Jul 2012 08:48:21 +0800, Steven Hum <sdot...@gmail.com>  
>> wrote:
>>
>> > Yeah, it is weird. A better (?) function illustrating the problem is
>> >
>> > function q; echo $argv;sleep $argv;echo $argv;end
>> > q 10s&; q 3s&;q 6s&
>> > 10s
>> > 10s
>> > 3s
>> > 3s
>> > 6s
>> > 6s
>> > Job 3, “q 6s&” has ended
>> > Job 2, “q 3s&” has ended
>> > Job 1, “q 10s&” has ended
>> >
>> > The sequence should be job 2,3,1, yet the function calls are completed
>> > in sequence (with observed delays) 10s, 3s and 6s rather than yielding
>> >
>> > 10s
>> > 3s
>> > 6s
>> > 3s
>> > 6s
>> > 10s
>> >
>> > Using ".. ;and ... ;and ... &" to join statements would still only
>> > process the last command in background and not the block of commands -
>> > yielding results similar to above.
>> >
>> > Steven
>> > --
>> > On Fri, 20 Jul 2012 at 03:15pm, Philip Ganchev wrote:
>> >
>> >> On Fri, Jul 20, 2012 at 10:51 AM, Steven Hum <sdot...@gmail.com>  
>> wrote:
>> >> > I posted this in the github issues and don't mean to double post,  
>> but
>> >> if
>> >> > "...statement...&" is intended only to work for simple commands,  
>> e.g.
>> >> >
>> >> > sleep 10s&; sleep 3s&; sleep 6s&
>> >> >
>> >> > (silly example, I know!) then I can close the ticket as this may  
>> not
>> >> be a bug
>> >> > by design.
>> >> >
>> >> > What I found was, for functions, e.g.
>> >> >
>> >> > function q; echo $argv; sleep 10s; echo $argv; end
>> >> >
>> >> > and execute
>> >> >
>> >> > q 1 &; q 2 &; q 3 &
>> >> >
>> >> > the output is
>> >> >
>> >> > 1
>> >> > 1
>> >> > 2
>> >> > 2
>> >> > 3
>> >> > 3
>> >> > Job 3, “q 3 &” has ended
>> >> > Job 2, “q 2 &” has ended
>> >> > Job 1, “q 1 &” has ended
>> >> [...]
>> >>
>> >> This is very surprising to me. I'm curious about the rationale here.  
>> I
>> >> would expect the output:
>> >>
>> >> 1
>> >> 2
>> >> 3
>> >> 1
>> >> Job 1, “q 1 &” has ended
>> >> 2
>> >> Job 2, “q 2 &” has ended
>> >> 3
>> >> Job 3, “q 3 &” has ended
>> >>
>> >> > If there is a correct "fish" way of spawning background function
>> >> processes, my
>> >> > second question is: is there a way to spawn a block of commands in
>> >> background
>> >> > similar to POSIX "(command1 && command2 && command3...) &". I tried
>> >> "begin;
>> >> > ...statements...; end &" but fish does not like that either (not
>> >> surprisingly
>> >> > given the above!)
>> >>
>> >> command1; and command2; and command3
>> >>
>> >> [...]
>> >
>> >
>> >
>> ------------------------------------------------------------------------------
>> > Live Security Virtual Conference
>> > Exclusive live event will cover all the ways today's security and
>> > threat landscape has changed and how IT managers can respond.  
>> Discussions
>> > will include endpoint security, mobile security and the latest in  
>> malware
>> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> > _______________________________________________
>> > Fish-users mailing list
>> > Fish-users@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/fish-users
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond.  
>> Discussions
>> will include endpoint security, mobile security and the latest in  
>> malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Fish-users mailing list
>> Fish-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/fish-users

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to