当前位置: 首页>>代码示例>>Golang>>正文


Golang application.Run函数代码示例

本文整理汇总了Golang中mojo/public/go/application.Run函数的典型用法代码示例。如果您正苦于以下问题:Golang Run函数的具体用法?Golang Run怎么用?Golang Run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Run函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: MojoMain

//export MojoMain
func MojoMain(handle C.MojoHandle) C.MojoResult {
	application.Run(&FortuneServerDelegate{
		fortuneFactory: FortuneFactory{
			fortune: NewFortuneImpl(),
		},
	}, system.MojoHandle(handle))
	return C.MOJO_RESULT_OK
}
开发者ID:vanadium,项目名称:mojo.v23proxy,代码行数:9,代码来源:fortune_server.go

示例2: TestApplication

func TestApplication(t *testing.T) {
	var apps []*mojoApp.Application_Proxy
	var responsesSent, appsTerminated sync.WaitGroup
	// Create and run applications.
	for i := 0; i < 2; i++ {
		request, pointer := mojoApp.CreateMessagePipeForApplication()
		apps = append(apps, mojoApp.NewApplicationProxy(pointer, bindings.GetAsyncWaiter()))
		// Each app instance provides echo service once when it creates
		// a connection and once other instance creates a connection.
		responsesSent.Add(2)
		appsTerminated.Add(1)
		delegate := &EchoDelegate{&responsesSent, urls[i]}
		go func() {
			application.Run(delegate, request.PassMessagePipe().ReleaseNativeHandle())
			appsTerminated.Done()
		}()
	}
	// Provide a shell for each application.
	for i := 0; i < 2; i++ {
		shellRequest, shellPointer := shell.CreateMessagePipeForShell()
		shellStub := shell.NewShellStub(shellRequest, &shellImpl{apps[i^1], urls[i]}, bindings.GetAsyncWaiter())
		go func() {
			if err := shellStub.ServeRequest(); err != nil {
				panic(err)
			}
			shellStub.Close()
		}()
		apps[i].Initialize(shellPointer, &[]string{urls[i]}, urls[i])
	}
	// Wait and then close pipes.
	responsesSent.Wait()
	for i := 0; i < 2; i++ {
		apps[i].RequestQuit()
	}
	appsTerminated.Wait()
	for i := 0; i < 2; i++ {
		apps[i].Close_Proxy()
	}
}
开发者ID:willbittner,项目名称:mojo,代码行数:39,代码来源:application_impl_test.go

示例3: MojoMain

//export MojoMain
func MojoMain(handle C.MojoHandle) C.MojoResult {
	application.Run(&principalServiceDelegate{}, system.MojoHandle(handle))
	return C.MOJO_RESULT_OK
}
开发者ID:ukode,项目名称:mojo,代码行数:5,代码来源:principal_service.go

示例4: MojoMain

//export MojoMain
func MojoMain(handle C.MojoHandle) C.MojoResult {
	application.Run(&HttpHandlerDelegate{}, system.MojoHandle(handle))
	return C.MOJO_RESULT_OK
}
开发者ID:Miaque,项目名称:mojo,代码行数:5,代码来源:http_handler.go

示例5: MojoMain

//export MojoMain
func MojoMain(handle C.MojoHandle) C.MojoResult {
	application.Run(&V23ProxyTestServerDelegate{}, system.MojoHandle(handle))
	return C.MOJO_RESULT_OK
}
开发者ID:vanadium,项目名称:mojo.v23proxy,代码行数:5,代码来源:test_server.go

示例6: MojoMain

//export MojoMain
func MojoMain(handle C.MojoHandle) C.MojoResult {
	application.Run(&RemoteEchoClientDelegate{}, system.MojoHandle(handle))
	return C.MOJO_RESULT_OK
}
开发者ID:vanadium,项目名称:mojo.v23proxy,代码行数:5,代码来源:echo_client.go

示例7: MojoMain

//export MojoMain
func MojoMain(handle C.MojoHandle) C.MojoResult {
	application.Run(&delegate{stubs: map[*bindings.Stub]struct{}{}}, system.MojoHandle(handle))
	return C.MOJO_RESULT_OK
}
开发者ID:vanadium,项目名称:mojo.discovery,代码行数:5,代码来源:discovery.go


注:本文中的mojo/public/go/application.Run函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。