Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/cgo: LockOSThread in callback #3775

Closed
dvyukov opened this issue Jun 25, 2012 · 6 comments
Closed

cmd/cgo: LockOSThread in callback #3775

dvyukov opened this issue Jun 25, 2012 · 6 comments
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented Jun 25, 2012

package main
/*
void lockOSThreadCallback(void);
inline static void lockOSThreadC(void)
{
        lockOSThreadCallback();
}
int usleep(unsigned usec);
inline static void sleep(void)
{
  usleep(100000);
}
*/
import "C"
import "runtime"
func main() {
    C.lockOSThreadC()
}
//export lockOSThreadCallback
func lockOSThreadCallback() {
    runtime.LockOSThread()
    runtime.UnlockOSThread()
    go func() {
        C.sleep()
    }()
    runtime.Gosched()
}

linux/amd64$ go run cgo.go
panic: runtime error: call of nil func value
[signal 0xb code=0x1 addr=0x0 pc=0x0]
@dvyukov
Copy link
Member Author

dvyukov commented Jun 25, 2012

Comment 1:

An obvious solution is to add recursion counter into LockOSThread(). However, it's not
yet implemented, so I suspect there are some reasons.

@rsc
Copy link
Contributor

rsc commented Sep 12, 2012

Comment 2:

Labels changed: added priority-later, removed priority-triage.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Sep 12, 2012

Comment 3:

Labels changed: added go1.1.

@rsc
Copy link
Contributor

rsc commented Dec 10, 2012

Comment 4:

Labels changed: added size-l.

@rsc
Copy link
Contributor

rsc commented Feb 1, 2013

Comment 5:

Owner changed to @rsc.

Status changed to Started.

@rsc
Copy link
Contributor

rsc commented Feb 1, 2013

Comment 6:

This issue was closed by revision b0a29f3.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants