Semaphores are good for synchronising threads but not good for updating the GUI. I only use semaphores with GUI if the thread also has to wait for input from the GUI.
Use PostEvent if the GUI needs to be changed by the thread.
See examples Mini Thread Control
Search found 4545 matches
- Sun Apr 21, 2024 2:18 pm
- Forum: Coding Questions
- Topic: Thread Parameters?
- Replies: 25
- Views: 1393
- Sat Apr 20, 2024 1:24 pm
- Forum: Tricks 'n' Tips
- Topic: Module ActiveScript for VBScript and JScript with PB-Runtime Variables
- Replies: 46
- Views: 22358
Re: Module ActiveScript for VBScript and JScript with PB-Runtime Variables
Update v2.13 - Added InterruptScriptThread - Added SetScriptErrorCallback - Added SetScriptTraceCallback Example running script in thread and interrupt the script Update ;-TOP ; Comment : Modul ActiveScript Example ScriptThread ; Version : v2.13 ; Link to ActiveScript : https://www.purebasic.fr/eng...
- Sat Apr 20, 2024 9:20 am
- Forum: Bugs - Documentation
- Topic: Linux SysTray
- Replies: 4
- Views: 261
Re: Linux SysTray
Since the Gtk.StatusIcon was removed from the GTK system, an alternative had to be found. This is the libappindicator.
It works as an alternative.
It works as an alternative.
- Fri Apr 19, 2024 8:34 pm
- Forum: Bugs - Documentation
- Topic: Linux SysTray
- Replies: 4
- Views: 261
Re: Linux SysTray
Do you have a concrete suggestion, which command descriptions should be changed and how? Thanks :) (btw. missing functionality on Linux is a really something for the docs, or more something Fred should look for?) change to Description Adds an icon in the SysTray area. (Window, MacOS) When an event ...
- Fri Apr 19, 2024 4:21 pm
- Forum: Coding Questions
- Topic: Webview & ""
- Replies: 16
- Views: 607
Re: Webview & ""
As I write programmes for Windows, Linux and macOS, I simply forward the menu event #PB_Menu_Quit as event #PB_Event_CloseWindow. So I only need to react to this event. ;-TOP Procedure UpdateWindow() Protected dx, dy dx = WindowWidth(0) dy = WindowHeight(0) - StatusBarHeight(0) - MenuHeight() ; Resi...
- Fri Apr 19, 2024 3:05 pm
- Forum: Coding Questions
- Topic: Webview & ""
- Replies: 16
- Views: 607
Re: Webview & ""
That is wrong. EventMenu() may only be queried if there is also an event #PB_Event_Menu.Mindphazer wrote: ↑Fri Apr 19, 2024 2:12 pmIt works if you click on "Quit", but you wanted to catch the ⌘Q shortcutPiero wrote: ↑Fri Apr 19, 2024 1:56 pm What confused me is that it's normally very easy:Code: Select all
Until event = #PB_Event_CloseWindow or EventMenu() = #PB_Menu_Quit
- Fri Apr 19, 2024 3:02 pm
- Forum: Coding Questions
- Topic: Would it be possible to make Socket UDP reliable by working side by side with TCP?
- Replies: 7
- Views: 382
Re: Would it be possible to make Socket UDP reliable by working side by side with TCP?
If no valid data is received (never [STX]text[ETX]) you can kick out the client. CloseNerkConnection
- Fri Apr 19, 2024 12:47 pm
- Forum: Coding Questions
- Topic: Webview & ""
- Replies: 16
- Views: 607
Re: Webview & ""
Not testet ... ... CompilerIf #PB_Compiler_OS = #PB_OS_MacOS Procedure MacOS_Quit() PostEvent(#PB_Event_CloseWindow, 0, 0) EndProcedure CompilerEndIf If OpenWindow(0, 100, 200, 500, 300, "PureBasic MiniBrowser v1.0", #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGa...
- Fri Apr 19, 2024 9:58 am
- Forum: Coding Questions
- Topic: Check if UseSQLiteDatabase is called
- Replies: 10
- Views: 290
Re: Check if UseSQLiteDatabase is called
maybe ... #EnableSQLite = #False CompilerIf #EnableSQLite #UseSQLiteDatabase = #True If Not UseSQLiteDatabase() Debug "Error ..." End EndIf CompilerEndIf Enumeration _own_db_format #OWN_DB_FORMAT_INMEMORY #OWN_DB_FORMAT_OWN #OWN_DB_FORMAT_XML #OWN_DB_FORMAT_JSON CompilerIf Defined(UseSQLit...
- Fri Apr 19, 2024 9:32 am
- Forum: Coding Questions
- Topic: Check if UseSQLiteDatabase is called
- Replies: 10
- Views: 290
Re: Check if UseSQLiteDatabase is called
Code: Select all
#EnableSQLite = #True
CompilerIf #EnableSQLite
If Not UseSQLiteDatabase()
Debug "Error ..."
End
EndIf
CompilerEndIf
- Fri Apr 19, 2024 9:20 am
- Forum: Bugs - Windows
- Topic: [Done] Static array index-less reference
- Replies: 11
- Views: 857
Re: [Done] Static array index-less reference
Actually, it's fine the way it was before. I don't see any problem here whether you write "mystruct\a = 2" or "mystruct\a[0] = 2".
Forbidding too much is not good either.
Forbidding too much is not good either.
- Thu Apr 18, 2024 11:15 pm
- Forum: Coding Questions
- Topic: Thread Parameters?
- Replies: 25
- Views: 1393
Re: Thread Parameters?
It is always better to take a structure and create it for the entire runtime of the thread with AllocateStructure.
- Thu Apr 18, 2024 10:56 pm
- Forum: Coding Questions
- Topic: Would it be possible to make Socket UDP reliable by working side by side with TCP?
- Replies: 7
- Views: 382
Re: Would it be possible to make Socket UDP reliable by working side by side with TCP?
KillThread is only called if WaitThread was not successful after time
- Thu Apr 18, 2024 10:52 pm
- Forum: Coding Questions
- Topic: Would it be possible to make Socket UDP reliable by working side by side with TCP?
- Replies: 7
- Views: 382
Re: Would it be possible to make Socket UDP reliable by working side by side with TCP?
You have programmed yourself a memory leak when rewriting thUDPServer. Client()\text is no longer corrected. In addition, you have removed the Repeat Until, which means that the data in the receive buffer can no longer be separated. There may be several sent data in the receive buffer that need to b...
- Thu Apr 18, 2024 8:43 pm
- Forum: Bugs - Windows
- Topic: [Done] Static array index-less reference
- Replies: 11
- Views: 857
Re: [Done] Static array index-less reference
Oops,
some codes will no longer work.
So please remove this adjustment.
some codes will no longer work.
So please remove this adjustment.