Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Adam Jackson
xserver
Commits
799715b8
Commit
799715b8
authored
Nov 19, 2008
by
Jeremy Huddleston
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XQuartz: pbproxy: Push the pbproxy Xevent processing into its own thread
and just have the AppKit thread wake it up.
parent
17eebd7c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
3 deletions
+32
-3
hw/xquartz/pbproxy/main.m
hw/xquartz/pbproxy/main.m
+0
-2
hw/xquartz/pbproxy/x-input.m
hw/xquartz/pbproxy/x-input.m
+32
-1
No files found.
hw/xquartz/pbproxy/main.m
View file @
799715b8
...
...
@@ -97,8 +97,6 @@ BOOL xpbproxy_init (void) {
return FALSE;
}
xpbproxy_input_run();
[pool release];
return TRUE;
...
...
hw/xquartz/pbproxy/x-input.m
View file @
799715b8
...
...
@@ -39,12 +39,39 @@
#include
<
unistd
.
h
>
#include
<
pthread
.
h
>
static
CFRunLoopSourceRef
xpbproxy
_
dpy
_
source
;
#ifdef
STANDALONE
_
XPBPROXY
BOOL
xpbproxy
_
prefs
_
reload
=
NO
;
#endif
static
pthread
_
mutex
_
t
xpbproxy
_
dpy
_
lock
=
PTHREAD
_
MUTEX
_
INITIALIZER
;
static
pthread
_
cond
_
t
xpbproxy
_
dpy
_
cond
=
PTHREAD
_
COND
_
INITIALIZER
;
static
inline
pthread
_
t
create
_
thread
(
void
*
func
,
void
*
arg
)
{
pthread
_
attr
_
t
attr
;
pthread
_
t
tid
;
pthread
_
attr
_
init
(
&
attr
)
;
pthread
_
attr
_
setscope
(
&
attr
,
PTHREAD
_
SCOPE
_
SYSTEM
)
;
pthread
_
attr
_
setdetachstate
(
&
attr
,
PTHREAD
_
CREATE
_
DETACHED
)
;
pthread
_
create
(
&
tid
,
&
attr
,
func
,
arg
)
;
pthread
_
attr
_
destroy
(
&
attr
)
;
return
tid
;
}
static
void
*
xpbproxy
_
input
_
thread
(
void
*
args
)
{
pthread
_
mutex
_
lock
(
&
xpbproxy
_
dpy
_
lock
)
;
while
(
true
)
{
xpbproxy
_
input
_
run
()
;
pthread
_
cond
_
wait
(
&
xpbproxy
_
dpy
_
cond
,
&
xpbproxy
_
dpy
_
lock
)
;
}
}
/*
Timestamp
when
the
X
server
last
told
us
it
'
s
active
*/
static
Time
last
_
activation
_
time
;
...
...
@@ -164,10 +191,14 @@ static void x_input_callback (CFSocketRef sock, CFSocketCallBackType type,
}
#endif
xpbproxy_input_run();
pthread_mutex_lock(&xpbproxy_dpy_lock);
pthread_cond_broadcast(&xpbproxy_dpy_cond);
pthread_mutex_unlock(&xpbproxy_dpy_lock);
}
BOOL xpbproxy_input_register(void) {
create_thread(xpbproxy_input_thread, NULL);
return add_input_socket(ConnectionNumber(xpbproxy_dpy), kCFSocketReadCallBack,
x_input_callback, NULL, &xpbproxy_dpy_source);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment