Re: threaded question

"Jochen Ritzel" <[email protected]>
Newsgroups gmane.comp.windows.shells.litestep
Message-ID <op.trrusnxud9nuum@w00t>
Heh, in short, threaded for modules means that litestep won't wait for the  
end of one module's bang before running another module's bang next.
It sounds nice, but it has pitfalls too, especially with scripts.

For an example, watch this:

####
*netloadmodule xlabel-4.0.7 ;threaded
*netloadmodule xtaskbar-2.0.3 ;threaded
*NetLoadModule timer-0.5 threaded

*xtaskbar fdgfds
*label fdgfds
fdgfdsX 0
fdgfdsY 0
fdgfdspaintingmode .singlecolor

*timer A #s 3000 !Labelmoveby fdgfds 50 0 10 50
*timer B #s 3001 !xtaskbarmoveby fdgfds 0 50 10 50
*timer C #s 5000 !execute [!Labelmoveby fdgfds 50 0 10 50][!xtaskbarmoveby  
fdgfds 0 50 10 50]
####

Greatest theme of all times. Anyway, if threading is enabled, A and B will  
run almost (1ms) at the same times, if not, first A runs and blocks LS,  
and B is enqueued and called only right after A is done. Notice !execute  
is a single call in either case and therefore isnt affected by threading  
at all.
Simple so far, but it can break stuff when you use scripts, since you have  
to make sure that stuff is still called in the right order. Since there is  
no native method for syncronisation in Litestep, it can be pretty hard to  
coordinate between modules in scripts.


On Thu, 03 May 2007 23:18:54 +0200, Antoine W. Campagna  
<[email protected]> wrote:

> On 5/3/07, Hale, Paul <[email protected]> wrote:
>>
>> Since I have been reading the NetLoadModule readme, I figured I would
>> finally ask what I never understood. What the hell is threaded, what
>> does it do and when should it be used?
>>
>> Paul Hale
>
>
>
> A thread is a parrallel execution of a
> routine. Every process running in your computer have at least one thread.
> Just like there are many processes running in parrallel on your CPU,  
> there
> may be many threads inside a process running in parallel.
>
> Threads are very helpful in modern programming, mainly to have UI
> responsiveness (in some thread) even
> when working with slow IO (like network communication in some other
> thread). Or to take advantage of mutli-core CPUs for long
> calculations.
>
>
> Having things multithreaded is a good thing because it allows a portion  
> to
> execute while another is waiting after something (say a directory  
> listing or
> a process startup). It can reduce or eliminate all the UI freezing that  
> can
> be observed in many programs (including LS). But multithread means that
> intermodule communication is harder and must be either asynchronous or
> blocking.
>
> The threaded option allows for a module to be run in its own thread.  
> Loading
> some modules threaded has advantages but it might disrupt the way it
> communicates with the core and/or other modules.
>
> I don't think no one tried which situations were benefitial from using
> threaded. So when should it be used ? I don't know, when it works  
> probably.
>
> Antoine



---------------------------------------------------------------------
    Can't Unsubscribe? Check http://desktopian.org/listunsub.html
        LS List Homepage: http://wuzzle.org/list/litestep.php
            Get the LS FAQ: http://lsfaq.shellfront.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.