Hi Xavi,

On 2009 Dec 21, at 02:09, Xavi wrote:

> Victor,
> 
> Thank you very much, only a small observation .-
> 
> ---- testwmtx.prg
> 
> STATIC s_hMutex
> 
> PROCEDURE Main()
>     LOCAL cAppName
> 
>     // It may be a random program name :)
>     hb_FNameSplit( hb_ProgName(), NIL, @cAppName )
> 
>     s_hMutex := wapi_CreateMutex( NIL, NIL, cAppName )
>     IF ! Empty( s_hMutex ) .AND. wapi_GetLastError() == 0
>        ? cAppName, "=> Hello World! OK."
>        WAIT
>        wapi_ReleaseMutex( s_hMutex )
>     ELSE
>        ? cAppName, "=> Application is running. Error", wapi_GetLastError()
>        WAIT
>     ENDIF
> 
>     RETURN
> ----
> 
> wapi_ReleaseMutex() does nothing, returns .F. because we not create the mutex 
> as owner.
> In this case it's better, I think it would be better to remove.

I'm not sure I understand, why aren't we the owner if we created 
the handle with success a few lines before?

[ Maybe s_hMutex := NIL would be enough, although in this case, 
I don't understand why GC release calls CloseHandle() while 
WAPI_RELEASEMUTEX() calls ReleaseMutex()? Should GC release 
call ReleaseMutex(), or both, or CloseHandle() also releases 
the mutex? Or both of them need to be called? A little bit 
confusing. ]

Well, anyway, let's do it as you think best, no capacity for 
me to understand this Windows subsystem.

> Maybe now is not the moment, when the time I'd like to find a solution for 
> wapi_par_HANDLE and wapi_ret_HANDLE.

I don't know what you mean, but okay :)

Brgds,
Viktor

_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to