Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Not Releasing
Message
From
09/10/2003 14:34:09
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Not Releasing
Miscellaneous
Thread ID:
00837054
Message ID:
00837054
Views:
96
Hello, I have been tasked with using CreateMutex to create a thread named "TheMutexObject". The purpose is to create this thread and then wait until no one else has that thread. I am running a Foxpro app with someone's Clarion app and we are having update contention in places. My code is simple and I am trying to test it with Messageboxes. I should be able to run many instances of this (in a exe) and as soon as I click "OK" on the messagebox, it should release the thread and the other instance should display the messagebox. It's not working and I don't know why.

Can anyone help me figure out why the it doesn't seem to be releasing?

Thanks so much...Tim


DECLARE INTEGER CloseHandle IN Kernel32 INTEGER hObject
DECLARE INTEGER CreateMutex IN Win32API INTEGER lpMutexAttributes, INTEGER bInitialOwner, STRING lpName
DECLARE Long WaitForSingleObject IN WIN32API Long hHandle, Long dwMilliseconds
DECLARE INTEGER ReleaseMutex IN Win32API INTEGER hMutex

lMutexString = "TheMutexObject"
lHandle = CreateMutex(0, 1, lMutexString)
lWaitReturn = WaitForSingleObject(lHandle, 0xFFFFFFFF)

MESSAGEBOX("This is the Time: " + TIME())
* File updates will go here

lReleaseReturn = ReleaseMutex(lHandle)
lCloseReturn = CloseHandle(lHandle)
Next
Reply
Map
View

Click here to load this message in the networking platform