detached 6d5fb77

objc: add comment about Objective-C global lock

objc.RegisterName grabs the global Objective-C lock. This commit adds a commit to Send, SendSuper and RegisterName about this lock.

Closes #86
commit
6d5fb775f30b3ac81494cfdefb424252b546d0a2
author
TotallyGamerJet · · 2023-01-07 17:37 UTC
committer
GitHub · · 2023-01-07 17:37 UTC
parent
a7c4d8f
signature
GPG Unverified4AEE18F83AFDEB23 The key is unknown
1 file · +8 -3
M objc/objc_runtime_darwin.go +8 -3
@@ -63,7 +63,9 @@ func (id ID) Class() Class {
6363 return object_getClass(id)
6464 }
6565
66-// Send is a convenience method for sending messages to objects.
66+// Send is a convenience method for sending messages to objects. This function takes a SEL
67+// instead of a string since RegisterName grabs the global Objective-C lock. It is best to cache the result
68+// of RegisterName.
6769 func (id ID) Send(sel SEL, args ...interface{}) ID {
6870 return objc_msgSend(id, sel, args...)
6971 }
@@ -76,7 +78,9 @@ type objc_super struct {
7678 superClass Class
7779 }
7880
79-// SendSuper is a convenience method for sending message to object's super
81+// SendSuper is a convenience method for sending message to object's super. This function takes a SEL
82+// instead of a string since RegisterName grabs the global Objective-C lock. It is best to cache the result
83+// of RegisterName.
8084 func (id ID) SendSuper(sel SEL, args ...interface{}) ID {
8185 var super = &objc_super{
8286 receiver: id,
@@ -89,7 +93,8 @@ func (id ID) SendSuper(sel SEL, args ...interface{}) ID {
8993 type SEL uintptr
9094
9195 // RegisterName registers a method with the Objective-C runtime system, maps the method name to a selector,
92-// and returns the selector value.
96+// and returns the selector value. This function grabs the global Objective-c lock. It is best the cache the
97+// result of this function.
9398 func RegisterName(name string) SEL {
9499 return sel_registerName(name)
95100 }
@@ -63,7 +63,9 @@ func (id ID) Class() Class {
63 return object_getClass(id)63 return object_getClass(id)
64 }64 }
65 65
66-// Send is a convenience method for sending messages to objects.66+// Send is a convenience method for sending messages to objects. This function takes a SEL
67+// instead of a string since RegisterName grabs the global Objective-C lock. It is best to cache the result
68+// of RegisterName.
67 func (id ID) Send(sel SEL, args ...interface{}) ID {69 func (id ID) Send(sel SEL, args ...interface{}) ID {
68 return objc_msgSend(id, sel, args...)70 return objc_msgSend(id, sel, args...)
69 }71 }
@@ -76,7 +78,9 @@ type objc_super struct {
76 superClass Class78 superClass Class
77 }79 }
78 80
79-// SendSuper is a convenience method for sending message to object's super81+// SendSuper is a convenience method for sending message to object's super. This function takes a SEL
82+// instead of a string since RegisterName grabs the global Objective-C lock. It is best to cache the result
83+// of RegisterName.
80 func (id ID) SendSuper(sel SEL, args ...interface{}) ID {84 func (id ID) SendSuper(sel SEL, args ...interface{}) ID {
81 var super = &objc_super{85 var super = &objc_super{
82 receiver: id,86 receiver: id,
@@ -89,7 +93,8 @@ func (id ID) SendSuper(sel SEL, args ...interface{}) ID {
89 type SEL uintptr93 type SEL uintptr
90 94
91 // RegisterName registers a method with the Objective-C runtime system, maps the method name to a selector,95 // RegisterName registers a method with the Objective-C runtime system, maps the method name to a selector,
92-// and returns the selector value.96+// and returns the selector value. This function grabs the global Objective-c lock. It is best the cache the
97+// result of this function.
93 func RegisterName(name string) SEL {98 func RegisterName(name string) SEL {
94 return sel_registerName(name)99 return sel_registerName(name)
95 }100 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close