Lasso Soft Inc. > Home


AuthorMarc Vos
LicensePublic Domain
Posted27 Aug 2010
Updated27 Aug 2010
More by this author...


This tag either returns an array of maps with found thread data or simply true or false. This way you can check if a Lasso process is already running. It searches for the given string in the thread_name field.

Sample Usage

mv_findThread('smtp', 'M', 'Y');'
'; mv_findThread('smtp', 'X', 'Y');'
'; mv_findThread('smtp', 'N', 'Y');'
'; if (mv_findThread('/process', 'X', 'Y'));  log_critical('Process X already running');  abort; /if; ]

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

define_tag('mv_findThread', -required='Name', -copy, -optional='current', -copy, -optional='signal', -copy);
/* current:
  M = Mark the array entry as being the calling thread.  X = eXclude the calling thread from the checks and the result list / signal.  any = Include calling thread in checks and result list without markings.
  Y = simply return true or false instead of a list with found threads.*/
  'tList' = array,
  'curID' = thread_getcurrentid,
  'insert'= false

	// Set default value to M(ark)
 if(! local_defined('current'));
  local('current') = 'M';

	// Set default value to N(o)
 if(! local_defined('signal'));
  local('signal') = 'N';

 iterate(Thread_List, local('tmp'));
  #tmp = Thread_Info(#tmp);
  if (#tmp->find('name') >> #name);

   if(#tmp->find('id') >> #curID);
    if(#current == 'M');
    else(#current != 'X');

    if(#signal == 'Y');

 if(#signal == 'Y');



No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home



©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft