-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Go: fix channel passing from Go->Rust->Go by runtime.Pinner
Signed-off-by: Rueian <[email protected]>
- Loading branch information
Showing
6 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package api | ||
|
||
import ( | ||
"testing" | ||
"unsafe" | ||
) | ||
|
||
func TestPinner(t *testing.T) { | ||
v := make(chan payload) | ||
|
||
p := pinner{} | ||
n := p.Pin(unsafe.Pointer(&v)) | ||
defer p.Unpin() | ||
|
||
if *(*chan payload)(getPinnedPtr(n)) != v { | ||
t.Fail() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package integTest | ||
|
||
import ( | ||
"runtime" | ||
|
||
"github.com/google/uuid" | ||
"github.com/valkey-io/valkey-glide/go/api" | ||
) | ||
|
||
func (suite *GlideTestSuite) TestParallelizedSetWithGC() { | ||
// The insane 640 parallelism is required to reproduce https://github.com/valkey-io/valkey-glide/issues/3207. | ||
suite.runParallelizedWithDefaultClients(640, 640000, func(client api.BaseClient) { | ||
runtime.GC() | ||
key := uuid.New().String() | ||
value := uuid.New().String() | ||
suite.verifyOK(client.Set(key, value)) | ||
}) | ||
} |