with shared memory

This commit is contained in:
2026-03-23 23:32:37 +01:00
parent 0f35b8eee7
commit 02fbc54e07
4 changed files with 41 additions and 3 deletions

View File

@@ -155,7 +155,8 @@
(libname libn))) (libname libn)))
) )
;(displayln (format "loading ~a" load-lib)) ;(displayln (format "loading ~a" load-lib))
(ffi-lib load-lib versions) (ffi-lib load-lib versions
;#:custodian (current-custodian))
) )
) )
libraries-to-preload) libraries-to-preload)
@@ -180,7 +181,12 @@
ffi-library os exp)))) ffi-library os exp))))
) )
]) ])
(ffi-lib webview-lib-file '("6" #f) #:get-lib-dirs (list os-lib-dir)))) (ffi-lib webview-lib-file '("6" #f)
#:get-lib-dirs (list os-lib-dir)
;#:custodian (current-custodian)
)
)
)
(define-ffi-definer define-rktwebview webview-lib) (define-ffi-definer define-rktwebview webview-lib)

View File

@@ -24,6 +24,9 @@ add_library(rktwebview_qt SHARED
rktutils.h rktutils.cpp rktutils.h rktutils.cpp
command.h command.cpp command.h command.cpp
shm.h shm.cpp
shmqueue.h shmqueue.cpp
) )
target_link_libraries(rktwebview_qt PRIVATE Qt${QT_VERSION_MAJOR}::Widgets) target_link_libraries(rktwebview_qt PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

View File

@@ -7,6 +7,7 @@
//#include <unistd.h> //#include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include "rktwebview_qt.h" #include "rktwebview_qt.h"
#include "shmqueue.h"
uint64_t current_ms() { uint64_t current_ms() {
using namespace std::chrono; using namespace std::chrono;
@@ -17,7 +18,14 @@ uint64_t current_ms() {
// Main C Interface // Main C Interface
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
Rktwebview_qt *handler = nullptr; typedef struct {
Shm *shm;
ShmQueue *command_queue;
ShmQueue *event_queue;
Rktwebview_qt *rkt;
} Handle_t;
Handle_t *handler = nullptr;
void rkt_webview_cleanup() void rkt_webview_cleanup()
{ {
@@ -25,6 +33,27 @@ void rkt_webview_cleanup()
// Does nothing. // Does nothing.
// See QTBUG-145033 // See QTBUG-145033
// QtWebEngine cannot be started as part of QApplication more than once in an application run. // QtWebEngine cannot be started as part of QApplication more than once in an application run.
// So we would need to cleanup at exit of racket/drracket.
// Cleaning up when exiting the current custodian is not enough.
/*
QApplication *app = handler->app();
if (app != nullptr) {
// testing with #:custodian (current-custodian)
QTimer t;
QObject::connect(&t, &QTimer::timeout, app, [app]() {
fprintf(stderr, "Quitting\n");
app->quit();
});
t.setSingleShot(true);
t.start(250);
fprintf(stderr, "Executing app\n");
app->exec();
fprintf(stderr, "App exited\n");
delete handler;
handler = nullptr;
}
*/
} }
} }