The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]



"Релиз языка программирования Go 1.8"
Версия для распечатки Пред. тема | След. тема
Форум Разговоры, обсуждение новостей
Исходное сообщение [ Отслеживать ]
Отдельный RSS теперь доступен для каждого обсуждения в форуме и каждого минипортала.
. "Релиз языка программирования Go 1.8" +/
Сообщение от Аноним (-), 18-Фев-17, 21:35 
Офигеть терминология в гугле. И пруфы аналитиков просто сыпятся.

https://go.googlesource.com/go/+/53fc330e2d154443acf3d01e0d6...

+// Shutdown gracefully shuts down the server without interrupting any
+// active connections. Shutdown works by first closing all open
+// listeners, then closing all idle connections, and then waiting
+// indefinitely for connections to return to idle and then shut down.
+// If the provided context expires before the shutdown is complete,
+// then the context's error is returned.
+func (s *Server) Shutdown(ctx context.Context) error {
+    atomic.AddInt32(&s.inShutdown, 1)
+    defer atomic.AddInt32(&s.inShutdown, -1)
+
+    s.mu.Lock()
+    lnerr := s.closeListenersLocked()
+    s.closeDoneChanLocked()
+    s.mu.Unlock()
+
+    ticker := time.NewTicker(shutdownPollInterval)
+    defer ticker.Stop()
+    for {
+        if s.closeIdleConns() {
+            return lnerr
+        }
+        select {
+        case <-ctx.Done():
+            return ctx.Err()
+        case <-ticker.C:
+        }
+    }
+}
+

Ответить | Правка | Наверх | Cообщить модератору

Оглавление
Релиз языка программирования Go 1.8, opennews, 17-Фев-17, 13:03  [смотреть все]
Форумы | Темы | Пред. тема | След. тема



Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру