| | 98 | ### simulate race condition with cas |
|---|
| | 99 | |
|---|
| | 100 | # gets foo1 - success |
|---|
| | 101 | @result = mem_gets($sock, "foo1"); |
|---|
| | 102 | ok($result[0] != "", "sock - gets foo1 is not empty"); |
|---|
| | 103 | |
|---|
| | 104 | # gets foo2 - success |
|---|
| | 105 | @result2 = mem_gets($sock2, "foo1"); |
|---|
| | 106 | ok($result2[0] != "","sock2 - gets foo1 is not empty"); |
|---|
| | 107 | |
|---|
| | 108 | print $sock "cas foo1 0 0 6 $result[0]\r\nbarva2\r\n"; |
|---|
| | 109 | print $sock2 "cas foo1 0 0 5 $result2[0]\r\napple\r\n"; |
|---|
| | 110 | |
|---|
| | 111 | my $res1 = <$sock>; |
|---|
| | 112 | my $res2 = <$sock2>; |
|---|
| | 113 | |
|---|
| | 114 | ok( ( $res1 eq "STORED\r\n" && $res2 eq "EXISTS\r\n") || |
|---|
| | 115 | ( $res1 eq "EXISTS\r\n" && $res2 eq "STORED\r\n"), |
|---|
| | 116 | "cas on same item from two sockets"); |
|---|
| | 117 | |
|---|