因爲我已經得到這些錯誤:SDL_LockSurface()用於多線程
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
main: ../../src/xcb_io.c:178: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
編輯:我也得有時這種錯誤:
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0"
after 48888 requests (48888 known processed) with 0 events remaining.
我試圖讓我的程序多線程安全等等在直接訪問像素之前,我正在調用SDL_LockSurface。
我知道,這些功能訪問像素:
int SDL_BlitSurface(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect);
int SDL_FillRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);
是否有直接訪問像素的任何其它功能?
@nos,那我該怎麼辦?我有幾個線程試圖訪問屏幕的特定區域。 –