static string[] getAliases(int rm, string address) { if (getAliasesBroken) { return(Array.Empty <string>()); } using (var semaphore = new Semaphore(0, 1)) { string[] result = Array.Empty <string>(); TapThread.Start(() => { var aliases = new StringBuilder(1024); short intfType = 0; short intfNum = 0; if (Visa.viParseRsrcEx(rm, address, ref intfType, ref intfNum, null, null, aliases) == Visa.VI_SUCCESS) { if (aliases.Length != 0) { result = new[] { aliases.ToString() } } ; } semaphore.Release(); }); if (!semaphore.WaitOne(5000)) { getAliasesBroken = true; log.Warning("VISA timed out when trying to get aliases. Skipping this from now on."); } return(result); } }