Пример #1
0
func create_thread(cb ThreadCallback) {
	_pid := new(C.pthread_t)
	log.Debug("> create_thread: %v", _pid)
	callbacks[_pid] = cb
	C.createThread(_pid)
	log.Debug("< create_thread: %v", _pid)
}
Пример #2
0
// initializes a thread using pthread_create
func Create(cb ThreadCallback, args interface{}) Thread {
	var pid C.pthread_t
	pidptr := &pid
	create_callback <- cb
	create_args <- args
	C.createThread(pidptr)

	return Thread(uintptr(unsafe.Pointer(&pid)))
}
Пример #3
0
// initializes a thread using pthread_create
func Create(cb ThreadCallback) Thread {
	var pid C.pthread_t
	pidptr := &pid
	create_callback <- cb

	C.createThread(pidptr)

	return Thread(uintptr(unsafe.Pointer(&pid)))
}
Пример #4
0
func CreateThread(cb ThreadCallback, r *http.Request, w http.ResponseWriter) {
	_pid := new(C.pthread_t)
	callbacks.Add(_pid, cb, r, w)

	C.createThread(_pid)
}
func CreateThread(function func()) {
	_pid := new(C.pthread_t)
	callbacks.Add(_pid, function)

	C.createThread(_pid)
}