--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
When I compile this simple program and run it under wine (1.7, ubuntu 14.04) it hangs indefinitely:package mainimport ("fmt""time")func main() {fmt.Println("before")fmt.Println(time.Now())time.Sleep(10 * time.Second)fmt.Println(time.Now())fmt.Println("after")}Is there a way I could debug this? Can somebody else reproduce this behavior?I tried cross-compiling it on my linux laptop and under Windows but it doesn't make a difference: it hangs. When run on Windows it works fine.
What version of Go do you use?
I've opened a bug on the wine bugtracker: https://bugs.winehq.org/show_bug.cgi?id=38272
--
The third comment is interesting:I guess Wine doesn't provide that interface.If they're unable to do so, it's possible that the Go runtime could be modified to know when it's running on Wine and do something else, but it's not clear a) that it's worth it (why slow down real Windows users for wine users, especially since Go already runs natively on ~everything), and b) that we'd ever be done. There might just always be another wine compatibility thing to work around? I haven't used Wine ~15 years. It's probably much better nowadays.
I can't think of any reason to use wine to run performancecritical Go programs (why not just run Go natively?)
The third comment is interesting:I guess Wine doesn't provide that interface.
If they're unable to do so, it's possible that the Go runtime could be modified to know when it's running on Wine and do something else, ...
Why can't you just make your Go program do what Wine would do to emulate
those Windows syscalls?
What are the arguments against using QPC?
Luckily, the Wine people have a nice cross-referenced copy of their
sources online.
http://source.winehq.org/WineAPI/OpenFileMappingW.html
http://source.winehq.org/WineAPI/MapViewOfFile.html
Starting there, you see that those forward to NtOpenSection and
NtMapViewOfSection, defined in:
http://source.winehq.org/source/dlls/ntdll/virtual.c#2553
As one would expect this ends up calling mmap with some file descriptor
(plus lots of impedance matching between the different APIs). When using
Wine that file descriptor is obtained through a Unix socket from the
"Wine server", which I guess is some thing that keeps inter-process
state that on Windows would be handled by the kernel.
But maybe that's not even necessary. When looking at a python library
found through Google (github.com/kutu/pyirsdk, the game is iRacing,
right?) there doesn't seem to be any extensive interaction between the
game and the client code. After "mmap-ing" (using some python mmap
module) the file it just starts reading from that.
That "Local\\IRSDKMemMapFileName" path, how is that handled by Wine?
Look around in /dev/shm, /tmp or whereever Wine keeps its stuff and see
if you can find something that corresponds to it. Note that this might
change with future Wine updates, though.
You could also try calling out to Winelib using cgo (make it use
winegcc). Actually, that might be the most straightforward solution, now
that I think of it. It's probably also the one most likely to keep
working with future changes to Wine.