Article View: comp.lang.c
Article #2170theoretically considering multithreading
From: fir
Date: Fri, 04 Dec 2026 10:03
Date: Fri, 04 Dec 2026 10:03
45 lines
3043 bytes
3043 bytes
as i said i dont do multithreading as it makes code rigid so i culd eventually implement it but as a last step not to complicate a code which is not about multithreading but i eventually could consider it theoretically right now my 'system' (rasterizer/game) loop looks like that dispatch_events() //0.2 ms (light set some variables) clear_frame_bitmap() // 1 ms (primitive memset) clear_depth_buffer() // 1ms (primitive memset) run_bag() //1 ms (change positions exacute some creations and deletions) draw_bag() // 12 ms (heavy calls cliping and drawing rasterisation) blit_frame() //1 ms those times are orientational i mean it depends on resolution ..the higher frame resolution the more time sole clears consume and honestly 2 clear and blit are quite noticable (2.5 ms in sum in lowres) i not insepcted it at the moment but probably run_bag() and draw_bag() may be seen independant this way that i can callanother run bag when it is yet rendered also i think if i would use switching pointers to frame and depth buffers then ui can clear them where second thread draws them so i think i cal just cal 2 clears and run_bag on one therad..than call draw not wait on its ending and switch pointers and run 2 clears and run_bag in parallel then wait unti draw_bag ends and call it immediatelly, yer maybe even calling blit in parallel some opinions how to exactly do that (in winapi preferably) this is a theoretical topic in a sense i wouldnt probably do that right now but proabably will do it in some future if that would work that would help especially in higher resolutions where clears+blit become really heavy or/and in case when run_bag would be heavy (if i got more objects and more collision detections)
Technical Details
Message-ID:
<11eu368$1d4cq$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: fir <profesor.fir@gmail.com> Newsgroups: comp.lang.c Subject: theoretically considering multithreading Date: Fri, 4 Dec 2026 11:03:40 +0100 Organization: A noiseless patient Spider Lines: 45 Message-ID: <11eu368$1d4cq$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 04 Dec 2026 10:03:52 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1479066"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+syF3Szb9SAIXbHOIabvLm2+1VDIrUdD8="; posting-host="0b511c55509f9977df10f2b4b2cd2b70" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0 SeaMonkey/2.53.24 Cancel-Lock: sha1:kj6QIX5gFd/thvGv0EAa0OiKPkY= sha256:wlat/XhQCoqd0ESqN5mdg7xkb7F5sJ7alNxRbFNMHDQ= sha1:9YKDyL+ulLeeDkjAkEOH8bj8+yA= sha256:/xymdzChODsn9LMm/j7XbSTxdkAhvcb+3fLX8gyuH3I= X-Mozilla-News-Host: news://news.eternal-september.org:119