This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Single threaded app fix


Single threaded app fix

Postby mm40 » Mar 12, 2003 @ 6:21am

User avatar
mm40
pm Member
 
Posts: 135
Joined: Feb 21, 2003 @ 9:11pm


Postby Johan » Mar 12, 2003 @ 11:37am

User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby mm40 » Mar 12, 2003 @ 5:51pm

User avatar
mm40
pm Member
 
Posts: 135
Joined: Feb 21, 2003 @ 9:11pm


Postby Johan » Mar 12, 2003 @ 6:01pm

User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby mm40 » Mar 12, 2003 @ 6:14pm

The code I posted is what my original app looked like. For the GapiDraw one I did place my draw() function inside ProcessNextFrame. You still need critical sections protecting it because in my code above WinProc and draw are guarenteed to not be called at the same time, because the loop is either drawing or posting messages.

But in GapiDrawApplication there is another thread that is created, so WinProc and ProcessNextFrame (which includes my draw) can be called at the same time. This is why my app was crashing, I expect and require that WinProc and ProcessNextFrame be called separate, this is why I need critical sections.

Your suggestions of posting input and handling it later would work fine, it is just a little easier to add 5 lines of code for critical sections, than queing and dequing another message buffer on top of the windows message buffer.
User avatar
mm40
pm Member
 
Posts: 135
Joined: Feb 21, 2003 @ 9:11pm


Postby Johan » Mar 12, 2003 @ 6:25pm

Very true... Multiple queues is unavoidable, with critical sections that follows.

Actually, the best solution would probably be to provide both multitthreaded + singlethreaded GapiApplications.. I'll see what I can wrap up in the next beta...

Thanks for the comments + feedback.
User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby Pejo Software - Per » Mar 13, 2003 @ 12:15am

You can use GapiDraw without using GapiApplication.
So if you are porting a single threaded PC game it might require less time if you just use basic GapiDraw.
Johan, perhaps it would be good to more clearly emphasize that GapiApplication is multithreaded in the documentation and the samples. I think that it is really bad if you are implemnting something in a multithreaded system when you think it is single threaded. Now when I come to think of it having a singlethread option might also give you a hint that you are using multiple threads otherwise :) .
User avatar
Pejo Software - Per
pm Insider
 
Posts: 343
Joined: Apr 25, 2002 @ 1:00pm
Location: Mölndal, Sweden


Postby Sm!rk » Mar 13, 2003 @ 8:47am

User avatar
Sm!rk
pm Member
 
Posts: 172
Joined: Dec 16, 2002 @ 4:40pm


Postby egarayblas » Mar 25, 2003 @ 12:11pm

-- home of the think & tap games!
User avatar
egarayblas
pm Insider
 
Posts: 627
Joined: Sep 14, 2002 @ 1:50am
Location: Philippines


Postby mm40 » Mar 27, 2003 @ 8:05am

User avatar
mm40
pm Member
 
Posts: 135
Joined: Feb 21, 2003 @ 9:11pm


Postby mm40 » Mar 27, 2003 @ 8:10am

User avatar
mm40
pm Member
 
Posts: 135
Joined: Feb 21, 2003 @ 9:11pm


Postby Johan » Apr 16, 2003 @ 2:55pm

Last edited by Johan on Apr 18, 2003 @ 3:52pm, edited 1 time in total.
User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby Hosed » Apr 18, 2003 @ 3:44pm

L. L. Goodwin<BR>Purveyor of Code<BR><A href="http://www.planettribes.com/hosed/">Hosed's House of Code</A>
User avatar
Hosed
pm Member
 
Posts: 249
Joined: Jan 3, 2002 @ 2:51am
Location: Montana, USA


Postby Johan » Apr 18, 2003 @ 3:49pm

User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Return to GapiDraw


Sort


Forum Description

The Cross-platform Graphics SDK for Palms, Pocket PCs, Symbian Devices, and Stationary PCs.

Moderators:

sponge, Johan

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum