computerwiz Posted February 1, 2010 Posted February 1, 2010 Hi! I've been wanting to synchronize multiple writer processes, all of which write some data into one file. But I've been unable to do so. Usually the error is that the processes are unable to access the object and sometimes an error occurs saying that "Handle is invalid". I don't think the code is required for this. If someone could demonstrate a working method, that would be enough. Could someone help me out? Thanks
Yashied Posted February 1, 2010 Posted February 1, 2010 Hi! I've been wanting to synchronize multiple writer processes, all of which write some data into one file. But I've been unable to do so. Usually the error is that the processes are unable to access the object and sometimes an error occurs saying that "Handle is invalid". I don't think the code is required for this. If someone could demonstrate a working method, that would be enough. Could someone help me out? Thanks A simple example for semaphores. #Include <GUIConstantsEx.au3> #Include <WinAPIEx.au3> Opt('MustDeclareVars', 1) If Not @Compiled Then MsgBox(0, '', 'To run this script, you must first compile it and then run the (.exe) file.') Exit EndIf Global $hSemaphore = _WinAPI_CreateSemaphore('MySemaphore', 2, 2) _WinAPI_WaitForSingleObject($hSemaphore) _MyGUI() _WinAPI_ReleaseSemaphore($hSemaphore) _WinAPI_FreeHandle($hSemaphore) Func _MyGUI() Local $Msg GUICreate('MyGUI') GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>_MyGUI WinAPIEx.au3 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
computerwiz Posted February 2, 2010 Author Posted February 2, 2010 Thanks a lot for your help!! And might I say its real simple than the mess of a code I've been doing. Thanks again. Cheers.
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