  	uint32_t mask;
  	struct wl_map objects;
  	struct wl_list global_listener_list;
-@@ -191,7 +195,11 @@ wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...)
- {
- 	struct wl_closure *closure;
+@@ -193,6 +197,11 @@ wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...)
+ 	struct wl_closure closure;
  	va_list ap;
+ 	int ret;
 +	int write_notification_event_fd;
 +	uint64_t write_notification_value;
 +	ssize_t success;
- 
++
 +	pthread_mutex_lock(&proxy->display->marshalling_mutex);
+ 
  	va_start(ap, opcode);
- 	closure = wl_connection_vmarshal(proxy->display->connection,
- 					 &proxy->object, opcode, ap,
-@@ -212,6 +220,18 @@ wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...)
- 		wl_closure_print(closure, &proxy->object, true);
- 
- 	wl_closure_destroy(closure);
+ 	ret = wl_closure_vmarshal(&closure, &proxy->object, opcode, ap,
+@@ -213,6 +222,18 @@ wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...)
+ 		wl_closure_print(&closure, &proxy->object, true);
+ 
+ 	wl_closure_destroy(&closure);
 +
 +	write_notification_event_fd = proxy->display->write_notification_event_fd;
 +	write_notification_value = 1;

 
 	debug = getenv("WAYLAND_DEBUG");
 	if (debug)
@@ -396,6 +417,21 @@ wl_display_connect(const char *name)
 		return NULL;
 	}
 

+#include <sys/eventfd.h>
 
 #include "wayland-util.h"
 #include "wayland-os.h"
@@ -63,6 +64,9 @@ struct wl_display {
 	struct wl_proxy proxy;
 	struct wl_connection *connection;
 	int fd;
