ࡱ> BE  !"#$%&'()*+,-./0123456789:;<=>?@ADFRoot Entry F 9;CWorkbookMETExtDataSummaryInformation(  @\pShenYujie Ba==Jv/8X@"1[SO10[SO10[SO10[SO1[SO1 [SO+""#,##0;""\-#,##05""#,##0;[Red]""\-#,##07""#,##0.00;""\-#,##0.00A""#,##0.00;[Red]""\-#,##0.00i*2_ ""* #,##0_ ;_ ""* \-#,##0_ ;_ ""* "-"_ ;_ @_ W))_ * #,##0_ ;_ * \-#,##0_ ;_ * "-"_ ;_ @_ y,:_ ""* #,##0.00_ ;_ ""* \-#,##0.00_ ;_ ""* "-"??_ ;_ @_ g+1_ * #,##0.00_ ;_ * \-#,##0.00_ ;_ * "-"??_ ;_ @_ /\$#,##0_);\(\$#,##0\)9\$#,##0_);[Red]\(\$#,##0\);\$#,##0.00_);\(\$#,##0.00\)E \$#,##0.00_);[Red]\(\$#,##0.00\)                + , )   * @ @     `8p`wayland multi-thread bug d Related code s bug solutionVV4" 2(/2"!u4s*K @=u4s*K |~x&x] յ>3̰ 0þ  ".Q%"΀ #ʢ( ,wEA1& 0k .Q&FrO?5tu_^^߷s>uVMN2뛻vjcr]D&ڲ(6z!:z -jʏ3-Zd>55k!Tmb??`2ju u uٲfb֡]Gdwymm8p_].<(yk500cbsRWnbQs#=#}NL;n_ A?cF?OQQQ?i!lOve}}Cvիlnb3.}͚=GSv7S7ޮM&y`ֱk'XI#9g91 c cxSp-\GBNPN)\=NT%f{'8^z<|R}on㴙ǰڜ"i3%wZ'?([iڼc8\S|s/2ٴ ^K_{:6zQr2u?N|A!>mܴc-+qdd3 ΍u&'c1Ǖܖ;}px{-pQB'FRHHOӉ'MZ1*l:l+LSVaF9bkL)ϜTU<(OLJ715ʜF8ɡZ, s/1\mS/!$x#?\Ij[-sc.O'9On*n7ؾs:NJVܦyp6 7.wuΰ燳bȻg*\g}gH}ĺ?Dk̟hi V'?O5^i|1<_LiyO9R0I`>e6.]|Er|q3΍ujդӣ Iրg+v v̳8񰣆t A+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+\xb%KZe^xo+W xw x݀Lgl{W\>>*/5:_/|oU| k_[!7Mo| mo|;|^O??a? ~c W_~S -gE/~U~{Gπ]'CS788 8p-.zn!7pM [n րOp[|*<w pg]w pw= po} x Ax(ax$QGx,qx"I'x*ix&Yg4s< />R/JEW.\jk\x7&o\pୀxw sh9#?A;S s> l=Wayland may have interface bug when multi-threads programing.sBriefly,a wl_proxy's property is still being modifying in a thread,while another thread may have sent it to server.Designed sequences map: Error Case:~wl_display_sync,wl_surface_frame,wl_display_get_registry,wl_registry_bind or other interfaces with callback have the same bug.& Related code in Wayland master branch: WL_EXPORT int0wl_display_roundtrip(struct wl_display *display){Dreturn wl_display_roundtrip_queue(display, &display->default_queue);}Twl_display_roundtrip_queue(struct wl_display *display, struct wl_event_queue *queue)struct wl_callback *callback;int done, ret = 0; done = 0;$callback = wl_display_sync(display);if (callback == NULL) return -1;8wl_proxy_set_queue((struct wl_proxy *) callback, queue);:wl_callback_add_listener(callback, &sync_listener, &done);while (!done && ret >= 0)0ret = wl_display_dispatch_queue(display, queue);if (ret == -1 && !done)wl_callback_destroy(callback); return ret;5wl_display_dispatch_queue(struct wl_display *display, struct wl_event_queue *queue)struct pollfd pfd[2];int ret;$pthread_mutex_lock(&display->mutex);%ret = dispatch_queue(display, queue);if (ret == -1)goto err_unlock;if (ret > 0) {&pthread_mutex_unlock(&display->mutex);=/* We ignore EPIPE here, so that we try to read events before= * returning an error. When the compositor sends an error it> * will close the socket, and if we bail out here we don't get$ * a chance to process the error. *//ret = wl_connection_flush(display->connection);3if (ret < 0 && errno != EAGAIN && errno != EPIPE) {$display_fatal_error(display, errno);display->reader_count++;pfd[0].fd = display->fd;pfd[0].events = POLLIN;do {ret = poll(pfd, 1, -1);&} while (ret == -1 && errno == EINTR);if (ret == -1) { wl_display_cancel_read(display);if (read_events(display) == -1)  err_unlock:)Here is our solution for wl_display_sync.|The key of the solution,which shown as red front bellow, is placing "add_listener" and "set_queue" insite the display->lock.nwl_surface_frame,wl_display_get_registry,wl_registry_bind or other interfaces with callback have the same bug.*And they can be solved in the similar way."solution code for wl_display_sync:struct wl_proxy *Awl_custom_proxy_marshal_array_constructor(struct wl_proxy *proxy,< uint32_t opcode, union wl_argument *args,8 const struct wl_interface *interface,- void* listener, void *data3 ,struct wl_event_queue * pQueue) struct wl_closure *closure;& struct wl_proxy *new_proxy = NULL;% const struct wl_message *message;/ pthread_mutex_lock(&proxy->display->mutex);8 message = &proxy->object.interface->methods[opcode]; if (interface) {9 new_proxy = create_outgoing_proxy(proxy, message,+ args, interface); if (new_proxy == NULL) goto err_unlock;H closure = wl_closure_marshal(&proxy->object, opcode, args, message); if (closure == NULL) {2 wl_log("Error marshalling request: %m\n"); abort(); } if (debug_client)8 wl_closure_print(closure, &proxy->object, true);'  // add listener before send request if(listener){\ wl_proxy_add_listener((struct wl_proxy *)new_proxy, (void (**)(void))listener,data);A wl_proxy_set_queue((struct wl_proxy *)new_proxy, pQueue);? if (wl_closure_send(closure, proxy->display->connection)) {. wl_log("Error sending request: %m\n");  wl_closure_destroy(closure); err_unlock:1 pthread_mutex_unlock(&proxy->display->mutex); return new_proxy;WL_EXPORT voidfwl_custom_proxy_marshal_prepare_args(union wl_argument* args, struct wl_proxy *proxy, uint32_t opcode,; const struct wl_interface *interface, ...)  if(args){ va_list ap;  va_start(ap, interface);T wl_argument_from_va_list(proxy->object.interface->methods[opcode].signature,0 args, WL_CLOSURE_MAX_ARGS, ap); va_end(ap);struct wl_callback *wl_custom_<display_sync(struct wl_display *wl_display,const struct wl_callback_listener *listener, void *data ,struct wl_event_queue * pQueue)= struct wl_proxy *proxy = (struct wl_proxy *)wl_display;B const struct wl_interface *interface = &wl_callback_interface;' uint32_t opcode = WL_DISPLAY_SYNC;0 union wl_argument args[WL_CLOSURE_MAX_ARGS];M wl_custom_proxy_marshal_prepare_args(args,proxy,opcode, interface, NULL); return (struct wl_callback *)wl_custom_proxy_marshal_array_constructor(proxy, opcode, args, interface, (void (**)(void))listener,data, pQueue); l[  @  p%bXbbbb  dMbP?_*+%&?'?(?)?" d[[?[[?& Up     t(2 22,o o"\D(    HA 0 VGr 191]&`  HA 0 VGr 234dl]&`>@d bbAggD  @ [%idmXp  dMbP?_*+%&?'?(?)?" d[[?[[?& U[                                         2$$,$$$, !"#$%')*+,-./123456789;=?  ! " # $ % ' ' ) * + ,! -" . / 1# 2$ 3% 4& 5' 6( 7) 8 9 ;* =" ?+8@ABCEFGHJLMOPQSUWXYZ @, A- B. C/ E0 F1 G H J L2 M O P Q S" S U W3 X" Y Z ,|v ^(    `G  s>Am zV: S Ǐ z 5 l +]` <Any modification of a generated callback wl_proxy may be ineffective,as other thread may have read and dispatched its corresponding events.<|B @ B !s> {4Y 10+]`>@dP PP  bbAggD  @ Q%x|~  dMbP?_*+%&?'?(?)?" d[[?[[?& UQ      4 5 6 7 8  9 : ; < = >  ? @ A B C D E F G H  I J K L: "#$%&'()*+,-.0235689:;<=? M "N #O $P %Q &R 'S (T )M *P +U ,V -L .M 0W 2X 3Y 5Z 6 8[ 9\ :] ; <^ =_ ?`8t@ABCEGHIJKLMNOP @a Ab Bc CM E Gd He I Jf Kg Lh Mi Nj Ok P ">@d   bbAggD   X `@@ Oh+'0x   ,8@HPp ShenYujie@|@Ɗ WPS Office՜.+,D՜.+,\  DocumentSummaryInformation8  (\dlKSOProductBuildVer2052-9.1.0.5184