10 August 2023, 23:58 | #1 |
Registered User
Join Date: Nov 2009
Location: Top of the world
Posts: 161
|
Question about P96 bitmap locking but mostly about timer.device
I'm trying to fix an old program that accesses graphics memory on RTG without taking any locks.
I've read the autodocs for both ChyberGraphics and Picasso96 and found lots of code examples. But none of the examples I can find has any error-handling if they fail to acquire the lock. Either they they just skip the whole operation on the bitmap, or they just do their thing anyway with cached pointers or other dubious tricks. In the program in question I got a routine that can't do the former. It would make for a bad user experience as it's handling bitmap dragging with mouse. I automatically went for a while-loop as in the following pseudo-code. Code:
lock=LockBitmap() while(not lock) { Delay(SomeTime) lock=LockBitmap() } DoWork() UnlockBitmap(lock) I do not want "SomeTime" to be unrealistically short, wasting cycles banging the lock to often. But I also want it short enough that the user-interface does not feel unnecessarily laggy if the lock fails. If my window is open on "Workbench Screen" on a lightly loaded system and I'm maximally unlucky, trying the lock just as the OS/P96 has made a blocking lock, how long must I expect to wait? And what is the best delay-function/timer-source for this case? Anything else I'm missing? -Hagbard Celine Last edited by hceline; 11 August 2023 at 00:07. |
11 August 2023, 07:35 | #2 | |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,247
|
Quote:
Thus, a single "if" would be sufficient. If the lock is NULL, do not do anything. |
|
11 August 2023, 07:51 | #3 |
Registered User
Join Date: Nov 2009
Location: Top of the world
Posts: 161
|
Ok, thank you.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Timer.device memory leak? | leemmcc | Coders. C/C++ | 6 | 01 February 2021 15:25 |
timer.device:GetSysTime:UNIT_VBLANK not recognized | VladR | Coders. Asm / Hardware | 8 | 26 April 2020 12:44 |
Lamer question about scsi.device | Jolabandola | support.Apps | 3 | 10 December 2019 20:00 |
[blitz] timer device + window IDCMP_INTUITICS = trouble | peceha | Coders. Blitz Basic | 6 | 20 October 2019 22:02 |
Using timer.device in C (VBCC) | DBAlex | Coders. General | 2 | 28 June 2011 22:10 |
|
|