Skip to content

Commit

Permalink
In case there's something about Objc's dispatch?
Browse files Browse the repository at this point in the history
  • Loading branch information
SaganRitual committed May 10, 2020
1 parent cdab266 commit c7601dc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
3 changes: 0 additions & 3 deletions Foil/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import Cocoa

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {



func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
}
Expand Down
14 changes: 7 additions & 7 deletions Foil/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<application id="hnw-xV-0zn" sceneMemberID="viewController">
<menu key="mainMenu" title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
<items>
<menuItem title="DeviceFallbackForCompute" id="1Xt-HY-uBw">
<menuItem title="Foil" id="1Xt-HY-uBw">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="DeviceFallbackForCompute" systemMenu="apple" id="uQy-DD-JDr">
<menu key="submenu" title="Foil" systemMenu="apple" id="uQy-DD-JDr">
<items>
<menuItem title="About DeviceFallbackForCompute" id="5kV-Vb-QxS">
<menuItem title="About Foil" id="5kV-Vb-QxS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="Ady-hI-5gd" id="Exp-CZ-Vem"/>
Expand All @@ -29,7 +29,7 @@
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
<menuItem title="Hide DeviceFallbackForCompute" keyEquivalent="h" id="Olw-nP-bQN">
<menuItem title="Hide Foil" keyEquivalent="h" id="Olw-nP-bQN">
<connections>
<action selector="hide:" target="Ady-hI-5gd" id="PnN-Uc-m68"/>
</connections>
Expand All @@ -47,7 +47,7 @@
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
<menuItem title="Quit DeviceFallbackForCompute" keyEquivalent="q" id="4sb-4s-VLi">
<menuItem title="Quit Foil" keyEquivalent="q" id="4sb-4s-VLi">
<connections>
<action selector="terminate:" target="Ady-hI-5gd" id="Te7-pn-YzF"/>
</connections>
Expand Down Expand Up @@ -640,7 +640,7 @@
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
<items>
<menuItem title="DeviceFallbackForCompute Help" keyEquivalent="?" id="FKE-Sm-Kum">
<menuItem title="Foil Help" keyEquivalent="?" id="FKE-Sm-Kum">
<connections>
<action selector="showHelp:" target="Ady-hI-5gd" id="y7X-2Q-9no"/>
</connections>
Expand All @@ -659,7 +659,7 @@
<scene sceneID="R2V-B0-nI4">
<objects>
<windowController id="B8D-0N-5wS" sceneMemberID="viewController">
<window key="window" title="DeviceFallbackForCompute" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="IQv-IB-iLA">
<window key="window" title="Foil" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="IQv-IB-iLA">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
Expand Down
3 changes: 2 additions & 1 deletion Foil/FoilViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class FoilViewController: NSViewController, MTKViewDelegate {

static let FoilNumSimulationConfigs = FoilSimulationConfigTable.count

var _view: MTKView { guard let v = self.view as? MTKView else { fatalError() }; return v }
// var _view: MTKView { guard let v = self.view as? MTKView else { fatalError() }; return v }
var _view: MTKView { (self.view as? MTKView)! }
var renderer: FoilRenderer!
var simulation: FoilSimulation!

Expand Down
7 changes: 6 additions & 1 deletion Simulation/FoilSimulation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ class FoilSimulation {

let config: FoilSimulationConfig

let simulationDispatchQueue = DispatchQueue(
label: "simulator.q", qos: .default, attributes: [/*serial*/],
target: DispatchQueue.global(qos: .default)
)

// When set to true, stop an asynchronously executed simulation
var halt = false

Expand Down Expand Up @@ -112,7 +117,7 @@ class FoilSimulation {
func runAsyncWithUpdateHandler(
updateHandler: @escaping FoilDataUpdateHandler, dataProvider: @escaping FoilFullDatasetProvider
) {
DispatchQueue.global(qos: .default).async {
simulationDispatchQueue.async {
self.commandQueue = self.device.makeCommandQueue()

self.runAsyncLoopWithUpdateHandler(updateHandler: updateHandler)
Expand Down

0 comments on commit c7601dc

Please sign in to comment.