1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-25 23:02:35 +03:00

Refactor slightly

This commit is contained in:
Tae Won Ha 2018-01-23 09:09:29 +01:00
parent 67c77f5b1f
commit d3fede50f1
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
2 changed files with 7 additions and 7 deletions

View File

@ -199,7 +199,7 @@ extension NvimView {
gui.async { gui.async {
self.bridgeLogger.debug(reason) self.bridgeLogger.debug(reason)
if self.uiBridge.isNvimQuitting == 1 || self.uiBridge.isNvimQuit { if self.uiBridge.isNvimQuitting || self.uiBridge.isNvimQuit {
return return
} }

View File

@ -11,7 +11,7 @@ class UiBridge {
let nvimQuitCondition = NSCondition() let nvimQuitCondition = NSCondition()
private(set) var isNvimQuitting = UInt32(0) private(set) var isNvimQuitting = false
private(set) var isNvimQuit = false private(set) var isNvimQuit = false
init(uuid: String, config: NvimView.Config) { init(uuid: String, config: NvimView.Config) {
@ -67,7 +67,7 @@ class UiBridge {
} }
func quit() { func quit() {
OSAtomicOr32Barrier(1, &self.isNvimQuitting) self.isNvimQuitting = true
self.closePorts() self.closePorts()
@ -86,7 +86,7 @@ class UiBridge {
func forceQuit() { func forceQuit() {
self.logger.info("Force-exiting NvimServer \(self.uuid).") self.logger.info("Force-exiting NvimServer \(self.uuid).")
OSAtomicOr32Barrier(1, &self.isNvimQuitting) self.isNvimQuitting = true
self.closePorts() self.closePorts()
self.forceExitNvimServer() self.forceExitNvimServer()
@ -302,7 +302,7 @@ class UiBridge {
/// Does not wait for reply. /// Does not wait for reply.
private func sendMessage(msgId: NeoVimAgentMsgId, data: Data?) { private func sendMessage(msgId: NeoVimAgentMsgId, data: Data?) {
if self.isNvimQuitting == 1 { if self.isNvimQuitting {
self.logger.info("NvimServer is quitting, but trying to send msg: \(msgId).") self.logger.info("NvimServer is quitting, but trying to send msg: \(msgId).")
return return
} }
@ -320,7 +320,7 @@ class UiBridge {
nil, nil,
nil) nil)
if self.isNvimQuitting == 1 { if self.isNvimQuitting {
return return
} }
@ -328,7 +328,7 @@ class UiBridge {
let msg = "Remote server responded with \(name(of: responseCode)) for msg \(msgId)." let msg = "Remote server responded with \(name(of: responseCode)) for msg \(msgId)."
self.logger.error(msg) self.logger.error(msg)
if self.isNvimQuitting == 0 { if !self.isNvimQuitting {
self.nvimView?.ipcBecameInvalid(msg) self.nvimView?.ipcBecameInvalid(msg)
} }
} }