mirror of https://github.com/grpc/grpc.io.git
Add note about wait_for_termination (#260)
This commit is contained in:
parent
9232a3fcd1
commit
810f55bec8
|
|
@ -305,10 +305,14 @@ def serve():
|
||||||
RouteGuideServicer(), server)
|
RouteGuideServicer(), server)
|
||||||
server.add_insecure_port('[::]:50051')
|
server.add_insecure_port('[::]:50051')
|
||||||
server.start()
|
server.start()
|
||||||
|
server.wait_for_termination()
|
||||||
```
|
```
|
||||||
|
|
||||||
Because `start()` does not block you may need to sleep-loop if there is nothing
|
The server `start()` method is non-blocking. A new thread will be instantiated
|
||||||
else for your code to do while serving.
|
to handle requests. The thread calling `server.start()` will often
|
||||||
|
not have any other work to do in the meantime. In this case, you can call
|
||||||
|
`server.wait_for_termination()` to cleanly block the calling thread until the
|
||||||
|
server terminates.
|
||||||
|
|
||||||
### Creating the client {#client}
|
### Creating the client {#client}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue