hello,
i know i could be overly paranoid at times.. but
is this the case that i need to protect my global memory location (that i read from / write to) with read/write memory barriers even if i'm only accessing that location from a single serial DispatchQueue? considering the fact that GCD can pick a different thread to run operations on that queue, and a further fact that different threads can run on different cores and thus have different L1/L2 caches, so that the barrier unprotected write to a location in one code invocation (that runs on my serial queue, that happens to be bound to thread1/core1 at the time) might not yet be visible to a different invocation of my code that runs a bit later on the same serial GCD queue but it so happens that now it runs on thread2/core2, so that the barrier unprotected read from that global memory location returns some stale data?
is the answer any different if we consider a serial (maxConcurrentCount=1) OperationQueue instead of a serial dispatch queue?
finally, is the answer any different if we consider a single NSThread / pthread instead of a serial dispatch queue? can a single thread be bound to different cores during its lifetime? (e.g. work on one core, then sleep, then awake on a different core).
thank you.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Tried to ask as a comment in the other thread:
https://developer.apple.com/forums/thread/650386?answerId=628394022#reply-to-this-question
But can't leave a comment in there for some reason (the thread is locked?). Asking exactly the same question, now for iOS 15. Anything changed in this area?
When selecting a stroke path for object on PKCanvas, the option "Snap to Shape" appears.
I understand this function is still in beta and has not made available natively to other PencilKit app. Is there a way using Stroke API to call this function directly after the user hold pencil for half a second when stroke is done drawing, just like how it behaves in native apps?
What best to pass to the options parameter of:
MTLDevice.makeBuffer(length:options:)
MTLDevice.makeBuffer(bytes:length:options:)
MTLDevice.makeBuffer(bytesNoCopy:length:options:deallocator:)
Basically I'm looking for a "plain English" explanation of MTLResourceOptions doc page.
In the following simplified app I want to change the status bar color from default black to white (the main iPhone theme is light) but nothing else. I'm partly succeeded doing so, but the theme of keyboard is wrong: when it is first appeared it is good (light) and as soon as i start typing it changes itself to unwanted dark. Is there a way to change just the status bar color but nothing else? Note that I want the status bar color be dynamic - sometimes white, sometimes black depending upon what the app is doing.
import SwiftUI
struct ContentView: View {
@State var string = "Hello, World"
var body: some View {
TextField("EditableText", text: $string)
.font(.largeTitle)
.frame(maxHeight: 1000)
.navigationTitle("Hello, World")
.background(
Color(red: 1, green: 0.7, blue: 0.7, opacity: 1)
)
.colorScheme(.light) // attempt to "undo" the effect
.preferredColorScheme(.dark)
}
}
@main struct NavBarTestApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
PS. I don't mind dropping to UIKit for status bar handling if it is not possible to do it in SwiftUI. The rest of app itself is SwiftUI and it is quite big, here I am showing a stripped down version.