  	return display;
  }
  
-@@ -432,6 +468,18 @@ wl_display_get_fd(struct wl_display *display,
+@@ -433,6 +470,18 @@ wl_display_get_fd(struct wl_display *display,
  	return display->fd;
  }
  

 	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;
 	va_list ap;
+	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);
+
+	write_notification_event_fd = proxy->display->write_notification_event_fd;
+	write_notification_value = 1;

 	len = wl_connection_data(display->connection, mask);
 
 	while (len > 0) {
@@ -528,6 +627,8 @@ wl_display_iterate(struct wl_display *display, uint32_t mask)
 		len -= size;
 	}
 
