[SR-Users] About setflag()'s parameter

Alex Balashov abalashov at evaristesys.com
Tue Jul 6 04:02:40 CEST 2010


On 07/05/2010 09:59 PM, zhou tianjun wrote:

> I'm in doubt of the means of setflag()'s parameter. I have looked for
> it everywhere including internet and the ser source code, but no any
> docs explained it in detail. can anybody tell me about it  ?

It sets bits in a 32-bit integer (it may be 64-bit on 64-bit 
platforms, of this I am not sure) that is bound to a transaction, so 
those "flags" may be accessed in requests and replies associated with 
a given transaction, or, further down in the execution flow of same 
message handler.

It is precisely equivalent to the way bit vectors are used in 
general-purpose programming languages, e.g.

     int flags = 0;

     flags |= (1 << 4);  /* Set bit 4 */

     if(flags & (1 << 4)) {
        printf("Bit 4 is set!\n");
     } else {
        printf("Bit 4 is not set!\n");
     }

     /* If bit 4 is set, unset it */

     if(flags & (1 << 4))
        flags &= ~(1 << 4);


-- 
Alex Balashov - Principal
Evariste Systems LLC
1170 Peachtree Street
12th Floor, Suite 1200
Atlanta, GA 30309
Tel: +1-678-954-0670
Fax: +1-404-961-1892
Web: http://www.evaristesys.com/



More information about the sr-users mailing list