Thanks, Sharon.

From: Sharon Lucas [mailto:luc...@us.ibm.com]
Sent: February-28-12 4:36 PM
To: Cindy Zhu
Cc: staf-users@lists.sourceforge.net
Subject: RE: [staf-users] Request Mutex

Hi, Cindy,

If you don't want to wait for the mutex semaphore to be released, then you can 
specify the TIMEOUT option with a timeout duration.  For example:

C:\>STAF local SEM REQUEST MUTEX MutexStart GARBAGECOLLECT NO TIMEOUT 10s
Error submitting request, RC: 37
Additional info
---------------
Request did not complete within the requested time

C:\>

If the SEM REQUEST MUTEX request is submitted without a timeout duration, then 
it will wait until the semaphore is available to you.  If it did not wait, then 
you would not know if your request succeeded or failed (or when it succeeded to 
know that you probably want to then release the mutex at some point).

Section "8.15.2 REQUEST" in the STAF User's Guide at 
http://staf.sourceforge.net/current/STAFUG.htm#HDRSEMSRV talks about the 
TIMEOUT option for a SEM MUTEX request as follows:

TIMEOUT specifies a timeout duration indicating the longest you are willing to 
wait to gain access to the semaphore. If this option is not specified, the 
request will wait indefinitely until the semaphore is available.

Note that there are many STAF service requests that have a TIMEOUT or WAIT 
option (e.g. a RESPOOL REQUEST request).

STAF provides an API / API options when submitting a STAF service request to 
submit the request asynchronously (instead of synchronously).  So, via a 
program (e.g. Java, C++, Python, Perl, Tcl), you can submit a STAF service 
request asynchronously which means that the request will return immediately 
returning the STAF request number.  When the STAF service request actually 
completes, a message is placed on the submitting handle's queue containing the 
request number along with its RC and Result.  This is talked about in section 
"6.2.5 STAFSubmit2" in the STAF User's Guide (when using C++) and there are 
similar sections in the STAF User Guides for Java, Python, Perl, and Tcl.

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com<mailto:luc...@us.ibm.com>
(512) 286-7313 or Tieline 363-7313




From:        Cindy Zhu <c...@fekete.com<mailto:c...@fekete.com>>
To:        Sharon Lucas/Austin/IBM@IBMUS,
Cc:        
"staf-users@lists.sourceforge.net<mailto:staf-users@lists.sourceforge.net>" 
<staf-users@lists.sourceforge.net<mailto:staf-users@lists.sourceforge.net>>
Date:        02/28/2012 05:13 PM
Subject:        RE: [staf-users] Request Mutex
________________________________



Hi Sharon,

Thank you for your reply.

When I sent the STAF command to request a mutex, I got no response back at all. 
It seems it was waiting for something. I couldn’t type any commands at all in 
the DOS command window. I had to use “Ctrl-C” to terminate.  It looked like 
this:
C:\>STAF local SEM REQUEST MUTEX MutexStart GARBAGECOLLECT NO

I figured out the mutex I requested was a pending mutex. I think the request 
was in a queue. That is why it is waiting.

It would be nice to get back the control even the requested mutex is pending.

Thanks,

Cindy

From: Sharon Lucas [mailto:luc...@us.ibm.com]
Sent: February-28-12 3:57 PM
To: Cindy Zhu
Cc: staf-users@lists.sourceforge.net<mailto:staf-users@lists.sourceforge.net>
Subject: Re: [staf-users] Request Mutex

Hi Cindy,

If the SEM REQUEST MUTEX request worked, you get RC 0 and no message in the 
result.  You can then query the mutex if you like to see that it is now exists 
and is owned.  For example:

C:\>STAF local SEM REQUEST MUTEX MutexStart GARBAGECOLLECT NO
Response
--------


C:\>STAF local SEM QUERY MUTEX MutexStart
Response
--------
{
 State           : Owned
 Owner           : {
   Machine                   : client1.austin.ibm.com
   Handle Name               : STAF/Client
   Handle                    : 147
   User                      : none://anonymous
   Endpoint                  : local://local
   Date-Time Requested       : 20120228-16:46:08
   Date-Time Acquired        : 20120228-16:46:08
   Perform Garbage Collection: No
 }
 Pending Requests: []
}

When you're ready to release the mutex semaphore, you can do so as follows.  
Note that if successful, RC=0 and there will be no message in the result.

C:\>STAF local SEM RELEASE MUTEX MutexStart FORCE
Response
--------


C:\>STAF local SEM QUERY MUTEX MutexStart
Response
--------
{
 State           : Unowned
 Owner           : <None>
 Pending Requests: []
}

C:\>

Note that the section "8.15.2 REQUEST" in the STAF User's Guide at 
http://staf.sourceforge.net/current/STAFUG.htm#HDRSEMSRV says in its "Results" 
sub-section says:

Results

The result buffer will contain no data on a successful return from a REQUEST 
command.


Note that many STAF service requests do not return any data in the result when 
successful when there is nothing more to say.  The RC=0 indicates that the STAF 
service request was successful.

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com<mailto:luc...@us.ibm.com>
(512) 286-7313 or Tieline 363-7313




From:        Cindy Zhu <c...@fekete.com<mailto:c...@fekete.com>>
To:        
"staf-users@lists.sourceforge.net<mailto:staf-users@lists.sourceforge.net>" 
<staf-users@lists.sourceforge.net<mailto:staf-users@lists.sourceforge.net>>,
Date:        02/28/2012 03:40 PM
Subject:        [staf-users] Request Mutex

________________________________




Hi,

I sent a STAF command “STAF local SEM REQUEST MUTEX MutexStart GARBAGECOLLECT 
NO” to request a mutex from the command line.  But I didn’t see any response.

Can you please tell me how to debug this?

I tried other STAF commands on the same machine and I got responses.

Thanks,

Cindy
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net<mailto:staf-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to