How to use 2501⌶0
3 posts
• Page 1 of 1
How to use 2501⌶0
The new I beam 2501 is to discard thread on exit and must be used on the same thread that you want to discard. If you consider the 2 following functions:
Each time 'ExecTask' is executed there is a new thread that is created (but not all the time and don't know why. Thread reuse ?). My question is where to put 2501⌶0 to discard the new thread on exit.
Thanks in advance
∇BackgroundTask[⎕]∇
[0] BackgroundTask;mat
[1] mat←50 50⍴?2500⍴100
∇ExecTask[⎕]∇
[0] ExecTask;⎕USING;action;task
[1]
[2] ⎕USING,←'System.Threading.Tasks,mscorlib.dll' 'System,mscorlib.dll'
[3] action←⎕NEW Action(⎕OR'BackgroundTask')
[4] task←⎕NEW Task(action)
[5] task.Start ⍬
Each time 'ExecTask' is executed there is a new thread that is created (but not all the time and don't know why. Thread reuse ?). My question is where to put 2501⌶0 to discard the new thread on exit.
Thanks in advance
-
PGilbert - Posts: 440
- Joined: Sun Dec 13, 2009 8:46 pm
- Location: Montréal, Québec, Canada
Re: How to use 2501⌶0
Found it, you need to put the 2501⌶0 as the last line of 'BackgroundTask' and the thread will be discarded. Looks like it is 'BackgroundTask' that is running on the new thread and obviously not 'ExecTask'. Like this:
However each time you execute 'ExecTask' the new thread id that is created is increase by 1 (and discarded at the end of the execution of the program). Is there a upper limit to the thread id (tid) that when reached it will cause a problem ?
∇BackgroundTask[⎕]∇
[0] BackgroundTask;mat
[1] mat←50 50⍴?2500⍴100
[2] {}2501⌶0
However each time you execute 'ExecTask' the new thread id that is created is increase by 1 (and discarded at the end of the execution of the program). Is there a upper limit to the thread id (tid) that when reached it will cause a problem ?
-
PGilbert - Posts: 440
- Joined: Sun Dec 13, 2009 8:46 pm
- Location: Montréal, Québec, Canada
Re: How to use 2501⌶0
Hi Pierre,
The tids will wrap around once they've reached the upper limit of 2,147,483,648.
The 2501 and 2502 I-Beams were implemented so that we don't get an ever increasing group of dormant threads which use resources.
The number of APL threads in use can be measured by looking at ⍴⎕TNUMS.
Regards,
Vince
The tids will wrap around once they've reached the upper limit of 2,147,483,648.
The 2501 and 2502 I-Beams were implemented so that we don't get an ever increasing group of dormant threads which use resources.
The number of APL threads in use can be measured by looking at ⍴⎕TNUMS.
Regards,
Vince
- Vince|Dyalog
- Posts: 443
- Joined: Wed Oct 01, 2008 9:39 am
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group