water Posted January 30, 2012 Posted January 30, 2012 I just noticed that Trac ticket #2108 was closed as "No bug".I understand that the code as it is now might already be broken because it does more than originally intended.On the other hand the change smartee proposed solved my problem (described ). I implemented and tested smartees code and it now allows to sequentially run compiled scripts an application I can't control starts in a bunch.I think every code change that enhances the functionality of AutoIt should be welcome. In particular when its jut 2 lines of code and the risk of side effects is minimal.I vote for implementing smartees change.Just my 2 cents. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Valik Posted January 30, 2012 Posted January 30, 2012 Does more than originally intended? Yeah, it completely breaks the pattern it was designed to implement.If that function gets touched it will be to remove the stupid behavior it should never have had. It will not receive additions to further take the function away from the singleton pattern. If you wish to implement other logic that relies on synchronization objects to limit simultaneous processes you are no longer meeting the singleton pattern and thus _Singleton() is not the right tool for the job.I don't know why this is so hard to understand.
ProgAndy Posted January 31, 2012 Posted January 31, 2012 (edited) If you have a resource that is required by multiple jobs, you should use the API directly and maybe consider semaphores for synchronization:http://msdn.microsoft.com/en-us/library/windows/desktop/ms682438%28v=vs.85%29.aspx_Singelton is designed to ensure only one instance is running and is not meant for waiting. Edited January 31, 2012 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
water Posted February 1, 2012 Author Posted February 1, 2012 I don't need the resource in my scripts. It's just used by _Singleton to do what it was designed for. I inserted the two lines to release the handle if the resource is already in use and now this modified version of _Singleton exactly does what I need. I don't care if this breaks the intended design - I had a problem and this modification solved the problem. I just thought this "enhancement" could be useful for others too. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Valik Posted February 1, 2012 Posted February 1, 2012 Whether it is useful or not is irrelevant. It's inappropriate for it to be in that function.
water Posted February 1, 2012 Author Posted February 1, 2012 That's fine for me - you are the boss. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Richard Robertson Posted February 1, 2012 Posted February 1, 2012 You know you can always include your own files with your own versions of functions.
water Posted February 1, 2012 Author Posted February 1, 2012 That's exactly what I do now. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now