Task class

Post

Posted
Rating:
#1 (In Topic #1393)
Regular
chrisRoald is in the usergroup ‘Regular’
 Hi All, I've tested creating a very basic task-class which inherits Task.  This worked successfully, except that I was hoping it would allow 'recursive' task-class instantiation - ie, the task's Main() method would be able to itself instantiate further tasks that would return processable data!…
At present my first 'level' task instantiates fine, but any further task instantiation - within the first-level task  - doesn't seem to work (no error or crashing, just nothing happening).
So I wondered, does anyone know that a task cannot run a further task - perhaps due to the Forking needed for tasks to work at all? *

*Why am I trying this??  Well in my main program, if I use the RDIR statement for very extensive/deep file structures, my 2-core processor can take up to 30secs to return the resulting file-paths array. So I thought, maybe a number of simultaneous Tasks could run DIR statements that would return the requisite file lists, both asynchronously (to the user program) and perhaps a bit faster too!

Any ideas on the Task calling Tasks issue, or a rapid way of returning file lists RDIR-style, gratefully received.
Happy New Year! everyone.
C.
Online now: No Back to the top

Post

Posted
Rating:
#2
Trainee
 Hi,
RDir was written in C and is very fast, in fact its speed is similar to an ls -Ra from shell and this depends on the speed of the disk and hardware in general.
Imagining having 2 simultaneous instances in the background to ask the same disk for 2 different directories with DIR would just waste the disk's time which can only fulfill one request at a time.
If you need the data all at once then there is only waiting.
If, on the other hand, you need them as the directory tree is visited by the user, you could build the tree with only the subdirectories with 1 level of depth and eventually read with a task the contents of only the subdirectories one level down (or up)
Online now: No Back to the top

Post

Posted
Rating:
#3
Regular
chrisRoald is in the usergroup ‘Regular’
 Rhoct, many thanks for this.  I understand the limitations of a hard-disk drive, but thought that solid-state drives might allow asychronous/simultaneous 'interrogation'!…  I guess not, considering your reply - and of course, plenty of users are still using hard-disk drives!
In my program, I will now be looking at being much more selective about returning full file-stats of potentially 'deep' directories.
Thanks again.
C
Online now: No Back to the top
1 guest and 0 members have just viewed this.