English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 13 June 2016, 00:21   #1
tygre
Returning fan!

tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 592
How to free resources locked by MUI programmatically for auto-update

Hi all!

I want to implement an auto-update feature for AmiModRadio because it is silly to ask users to download/install new versions of a program designed to access the Internet

Unfortunately, MUI locks resources (and also here) upon exit so how can I programmatically free/unlock these resources?

Thanks in advance!
tygre is offline  
Old 13 June 2016, 00:24   #2
tygre
Returning fan!

tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 592
PS. I could probably call FlushMUI from AmiModRadio but that would not be elegant and, besides, I am not sure that I can distribute FlushMUI with AmiModRadio independently and that it works with MUI version < 4?
tygre is offline  
Old 13 June 2016, 11:20   #3
tboeckel
 
Posts: n/a
Quote:
Originally Posted by tygre View Post
PS. I could probably call FlushMUI from AmiModRadio but that would not be elegant and, besides, I am not sure that I can distribute FlushMUI with AmiModRadio independently and that it works with MUI version < 4?
I have told you already that FlushMUI is definitely the wrong tool for the purpose you desire, as it will terminate all running MUI applications. I guess the users will not be really amused if all their MUI applications are forced to quit just because they update your program.

I will see if I can come up with a special program to let MUI flush the cached images only. But this will definitely NOT work with MUI3 and there is no guarantee that the images files you are going to replace really can be flushed. If they are still in use then there is no other way than to terminate the applications using that specific image.
 
Old 13 June 2016, 12:14   #4
tygre
Returning fan!

tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 592
Quote:
Originally Posted by tboeckel View Post
I have told you already that FlushMUI is definitely the wrong tool for the purpose you desire, as it will terminate all running MUI applications. I guess the users will not be really amused if all their MUI applications are forced to quit just because they update your program.
You are confusing me with Retrofan. So drop the "already"...

Quote:
Originally Posted by tboeckel View Post
I will see if I can come up with a special program to let MUI flush the cached images only. But this will definitely NOT work with MUI3 and there is no guarantee that the images files you are going to replace really can be flushed. If they are still in use then there is no other way than to terminate the applications using that specific image.
Why would there be a need for a special program? I need a programmatic way of flushing resources, will you share the source of that "special" program with me?
tygre is offline  
Old 13 October 2016, 22:26   #5
tygre
Returning fan!

tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 592
Hi Thore!

Sorry to bump this thread but would you have a programmatic way to flush resources? I would need it to create an auto-updating MUI program...

Cheers!
tygre is offline  
Old 20 November 2016, 05:29   #6
Saghalie
Registered User

Saghalie's Avatar
 
Join Date: Nov 2014
Location: FT Lewis, WA
Posts: 205
Assuming I am understanding what you want, this is the code I use to free up MUI resources:
Code:
    MUI_DisposeObject(Object->App);
    FreeVec(Object);
And then I just free up the library and close the program.
Of course I have declared all my MUI resources in struct ObjApp * Object;

Last edited by DH; 14 November 2017 at 18:28. Reason: Deleted direct signature
Saghalie is offline  
Old 04 December 2016, 01:55   #7
tygre
Returning fan!

tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 592
Hi there Saghalie!

Quote:
Originally Posted by Saghalie View Post
Assuming I am understanding what you want, this is the code I use to free up MUI resources:
Code:
    MUI_DisposeObject(Object->App);
    FreeVec(Object);
And then I just free up the library and close the program.
Of course I have declared all my MUI resources in struct ObjApp * Object;
Thanks a lot for your reply and your help! Yes, I think that you got what I want to do... I will definitely try your suggestion but "just" doing MUI_DisposeObject(Object->App); leaves the images in the library cache but I cannot really close the library because other programs may use it... Any ideas?

Cheers!
tygre is offline  
Old 20 September 2018, 06:51   #8
tygre
Returning fan!

tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 592
Quote:
Originally Posted by tboeckel View Post
I have told you already that FlushMUI is definitely the wrong tool for the purpose you desire, as it will terminate all running MUI applications. I guess the users will not be really amused if all their MUI applications are forced to quit just because they update your program.

I will see if I can come up with a special program to let MUI flush the cached images only. But this will definitely NOT work with MUI3 and there is no guarantee that the images files you are going to replace really can be flushed. If they are still in use then there is no other way than to terminate the applications using that specific image.
Hi Thore,

Just to confirm with you that I could do the other way around: wait to update the files after the next reboot and the next run of the updater, i.e., before any file is locked by MUI.

I could test whether any file is locked using:
Code:
lock = Lock(file_name, EXCLUSIVE_LOCK);
Would that tell me whether a file is being locked by MUI?

Best,
Tygre
tygre is offline  
Old 08 October 2018, 20:23   #9
tygre
Returning fan!

tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 592
PS. Just to close this threat: Thore confirmed that checking the lock is the way to go
tygre is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto-update window tolkien request.Apps 4 09 October 2016 00:23
How to Programmatically Quit a MUI Application? tygre support.Apps 2 02 March 2016 01:24
Horizontal Group Has Content Partially Hidden in MUI v4, Not MUI v3.8a tygre support.Apps 6 29 February 2016 04:27
Free TCP Stack for 3.1 (no MUI) Leandro Jardim support.Apps 4 28 May 2012 05:45
WinUAE Auto-Update? Mequa request.UAE Wishlist 15 19 October 2010 12:37

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 19:02.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.07200 seconds with 15 queries