[beast: 47/95] BSE: move init functions to bsecore, pass wakeup lambdas to sfi_com_port



commit fdae632e12abb77f247830c74c585e0188416707
Author: Tim Janik <timj gnu org>
Date:   Tue Mar 19 03:04:41 2013 +0100

    BSE: move init functions to bsecore, pass wakeup lambdas to sfi_com_port

 beast-gtk/bstdefs.hh    |    4 +++
 beast-gtk/bstmain.cc    |   22 ++++++++++++------
 beast-gtk/testgui.cc    |    4 +-
 bse/bse.hh              |    8 +------
 bse/bsecore.cc          |   23 +++++++++++++++++++
 bse/bsecore.hh          |    6 +++++
 bse/bsemain.cc          |   55 ++++++++++++++++++++--------------------------
 bse/bsemain.hh          |    7 +----
 sfi/sficomport.cc       |   55 ++++++++++++++++++++--------------------------
 sfi/sficomport.hh       |   44 ++++++++++++++++++++++---------------
 shell/bsescm.cc         |    6 ++--
 tests/bse/cxxbinding.cc |    4 +-
 tests/perftest.cc       |    6 ++--
 13 files changed, 135 insertions(+), 109 deletions(-)
---
diff --git a/beast-gtk/bstdefs.hh b/beast-gtk/bstdefs.hh
index cdbeb71..7c6711d 100644
--- a/beast-gtk/bstdefs.hh
+++ b/beast-gtk/bstdefs.hh
@@ -62,10 +62,14 @@ typedef enum /*< skip >*/
 #define BEAST_GETTEXT_DOMAIN (NULL)
 #define _(str) dgettext (BEAST_GETTEXT_DOMAIN, str)
 #define N_(str)        (str)
+
 /* --- internal stuff --- */
 void    beast_show_about_box (void);
+void    bst_main_loop_wakeup    ();
 extern gboolean bst_developer_hints;
 extern gboolean bst_debug_extensions;
 extern gboolean bst_main_loop_running;
+
 G_END_DECLS
+
 #endif /* __BST_DEFS_H__ */
diff --git a/beast-gtk/bstmain.cc b/beast-gtk/bstmain.cc
index b814407..ddbe5c7 100644
--- a/beast-gtk/bstmain.cc
+++ b/beast-gtk/bstmain.cc
@@ -36,6 +36,7 @@ static gboolean     register_core_plugins = TRUE;
 static gboolean     register_ladspa_plugins = TRUE;
 static gboolean     register_scripts = TRUE;
 static gboolean     may_auto_update_bse_rc_file = TRUE;
+
 /* --- functions --- */
 static void
 server_registration (SfiProxy     server,
@@ -55,6 +56,7 @@ server_registration (SfiProxy     server,
        g_message ("failed to register \"%s\": %s", what, error);
     }
 }
+
 int
 main (int   argc,
       char *argv[])
@@ -88,8 +90,7 @@ main (int   argc,
   sfi_msg_allow ("misc");
   /* ensure SFI can wake us up */
   sfi_thread_set_name ("Beast GUI");
-  sfi_thread_set_wakeup ((BirnetThreadWakeup) g_main_context_wakeup,
-                        g_main_context_default (), NULL);
+  sfi_thread_set_wakeup ((BirnetThreadWakeup) bst_main_loop_wakeup, NULL, NULL);
   /* initialize Gtk+ and go into threading mode */
   bst_early_parse_args (&argc, &argv);
   if (bst_debug_extensions)
@@ -136,8 +137,8 @@ main (int   argc,
     }
   /* start BSE core and connect */
   bst_splash_update_item (beast_splash, _("BSE Core"));
-  bse_init_async (&argc, &argv, "BEAST", config);
-  sfi_glue_context_push (bse_init_glue_context ("BEAST"));
+  Bse::init_async (&argc, &argv, "BEAST", config);
+  sfi_glue_context_push (Bse::init_glue_context ("BEAST", bst_main_loop_wakeup));
   source = g_source_simple (GDK_PRIORITY_EVENTS, // G_PRIORITY_HIGH - 100,
                            (GSourcePending) sfi_glue_context_pending,
                            (GSourceDispatch) sfi_glue_context_dispatch,
@@ -390,6 +391,13 @@ main (int   argc,
   return 0;
 }
 
+/// wake up the main context used by the Beast main event looop.
+void
+bst_main_loop_wakeup ()
+{
+  g_main_context_wakeup (g_main_context_default ());
+}
+
 static void
 bst_early_parse_args (int    *argc_p,
                      char ***argv_p)
@@ -630,7 +638,7 @@ bst_early_parse_args (int    *argc_p,
   *argc_p = e;
   if (initialize_bse_and_exit)
     {
-      bse_init_async (argc_p, argv_p, "BEAST", NULL);
+      Bse::init_async (argc_p, argv_p, "BEAST", NULL);
       exit (0);
     }
 }
@@ -640,8 +648,8 @@ bst_exit_print_version (void)
   const gchar *c;
   gchar *freeme = NULL;
   /* hack: start BSE, so we can query it for paths, works since we immediately exit() afterwards */
-  bse_init_async (NULL, NULL, "BEAST", NULL);
-  sfi_glue_context_push (bse_init_glue_context ("BEAST"));
+  Bse::init_async (NULL, NULL, "BEAST", NULL);
+  sfi_glue_context_push (Bse::init_glue_context ("BEAST", bst_main_loop_wakeup));
   g_print ("BEAST version %s (%s)\n", BST_VERSION, BST_VERSION_HINT);
   g_print ("Libraries: ");
   g_print ("GLib %u.%u.%u", glib_major_version, glib_minor_version, glib_micro_version);
diff --git a/beast-gtk/testgui.cc b/beast-gtk/testgui.cc
index cb9eb95..9f28d59 100644
--- a/beast-gtk/testgui.cc
+++ b/beast-gtk/testgui.cc
@@ -95,8 +95,8 @@ main (int   argc,
   _bst_gconfig_init ();
   _bst_skin_config_init ();
   /* start BSE core and connect */
-  bse_init_async (&argc, &argv, "TestGUI", NULL);
-  sfi_glue_context_push (bse_init_glue_context ("TestGUI"));
+  Bse::init_async (&argc, &argv, "TestGUI", NULL);
+  sfi_glue_context_push (Bse::init_glue_context ("TestGUI", []() { g_main_context_wakeup 
(g_main_context_default()); }));
   GSource *source = g_source_simple (G_PRIORITY_HIGH - 100,
                                      (GSourcePending) sfi_glue_context_pending,
                                      (GSourceDispatch) sfi_glue_context_dispatch,
diff --git a/bse/bse.hh b/bse/bse.hh
index 36402c3..6cbb0ad 100644
--- a/bse/bse.hh
+++ b/bse/bse.hh
@@ -7,13 +7,7 @@
 #include <bse/bsecore.hh>
 
 G_BEGIN_DECLS
-/* initialize BSE and start the core thread */
-void           bse_init_async          (gint            *argc,
-                                        gchar         ***argv,
-                                        const char     *app_name,
-                                        SfiInitValue    values[]);
-/* provide SFI glue layer context for BSE */
-SfiGlueContext*        bse_init_glue_context   (const gchar    *client);
+
 /* library versioning */
 extern const guint   bse_major_version;
 extern const guint   bse_minor_version;
diff --git a/bse/bsecore.cc b/bse/bsecore.cc
index 61fb96b..550b730 100644
--- a/bse/bsecore.cc
+++ b/bse/bsecore.cc
@@ -1,8 +1,31 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
 #include "bsecore.hh"
+#include "bsemain.hh"
 
 namespace Bse {
 
+// == BSE Initialization ==
+
+/** Create SFI glue layer context.
+ * Create and push an SFI glue layer context for the calling thread, to enable communications with the
+ * main BSE thread library.
+ */
+SfiGlueContext*
+init_glue_context (const gchar *client, const std::function<void()> &caller_wakeup)
+{
+  return _bse_glue_context_create (client, caller_wakeup);
+}
+
+/** Initialize and start BSE.
+ * Initialize the BSE library and start the main BSE thread. Arguments specific to BSE are removed
+ * from @a argc / @a argv.
+ */
+void
+init_async (int *argc, char ***argv, const char *app_name, SfiInitValue values[])
+{
+  _bse_init_async (argc, argv, app_name, values);
+}
+
 // == TaskRegistry ==
 static Rapicorn::Mutex    task_registry_mutex_;
 static TaskRegistry::List task_registry_tasks_;
diff --git a/bse/bsecore.hh b/bse/bsecore.hh
index b3aa99e..7997f55 100644
--- a/bse/bsecore.hh
+++ b/bse/bsecore.hh
@@ -19,6 +19,12 @@ public:
   static List  list    ();              ///< Retrieve a copy to the list of all tasks in registry.
 };
 
+// == BSE Initialization ==
+
+SfiGlueContext*        init_glue_context   (const gchar *client, const std::function<void()> &caller_wakeup);
+void           init_async          (int *argc, char ***argv, const char *app_name, SfiInitValue values[]);
+
+
 } // Bse
 
 #endif /* __BSE_CORE_HH__ */
diff --git a/bse/bsemain.cc b/bse/bsemain.cc
index 42e6fec..04f23d0 100644
--- a/bse/bsemain.cc
+++ b/bse/bsemain.cc
@@ -20,6 +20,7 @@
 #include <unistd.h>
 #include <sfi/sfitests.hh> /* sfti_test_init() */
 using namespace Birnet;
+
 /* --- prototypes --- */
 static void    bse_main_loop           (Rapicorn::AsyncBlockingQueue<int> *init_queue);
 static void    bse_async_parse_args    (gint           *argc_p,
@@ -76,10 +77,7 @@ bse_gettext (const gchar *text)
 static std::thread async_bse_thread;
 
 void
-bse_init_async (gint           *argc,
-               gchar        ***argv,
-                const char     *app_name,
-                SfiInitValue    values[])
+_bse_init_async (int *argc, char ***argv, const char *app_name, SfiInitValue values[])
 {
   assert (async_bse_thread.get_id() == std::thread::id());      // no async_bse_thread started
   bse_init_textdomain_only();
@@ -130,50 +128,45 @@ bse_check_version (uint required_major, uint required_minor, uint required_micro
   return NULL;
 }
 
-typedef struct {
-  SfiGlueContext *context;
+struct AsyncData {
   const gchar *client;
-  BirnetThread *thread;
-} AsyncData;
+  const std::function<void()> &caller_wakeup;
+  Rapicorn::AsyncBlockingQueue<SfiGlueContext*> result_queue;
+};
+
 static gboolean
 async_create_context (gpointer data)
 {
   AsyncData *adata = (AsyncData*) data;
   SfiComPort *port1, *port2;
-  sfi_com_port_create_linked ("Client", adata->thread, &port1,
-                             "Server", sfi_thread_self (), &port2);
-  adata->context = sfi_glue_encoder_context (port1);
+  sfi_com_port_create_linked ("Client", adata->caller_wakeup, &port1,
+                             "Server", bse_main_wakeup, &port2);
+  SfiGlueContext *context = sfi_glue_encoder_context (port1);
   bse_janitor_new (port2);
-  /* wakeup client */
-  sfi_thread_wakeup (adata->thread);
-  return FALSE; /* single-shot */
+  adata->result_queue.push (context);
+  return false; // run-once
 }
+
 SfiGlueContext*
-bse_init_glue_context (const gchar *client)
+_bse_glue_context_create (const char *client, const std::function<void()> &caller_wakeup)
 {
-  AsyncData adata = { 0, };
-  GSource *source;
-  g_return_val_if_fail (client != NULL, NULL);
-  /* function runs in user threads and queues handler in BSE thread to create context */
+  g_return_val_if_fail (client && caller_wakeup, NULL);
+  AsyncData adata = { client, caller_wakeup };
+  // function runs in user threads and queues handler in BSE thread to create context
   if (bse_initialization_stage < 2)
-    g_error ("%s() called without prior %s()",
-            "bse_init_glue_context",
-            "bse_init_async");
-  /* queue handler to create context */
-  source = g_idle_source_new ();
+    g_error ("%s: called without prior %s()", __func__, "Bse::init_async");
+  // queue handler to create context
+  GSource *source = g_idle_source_new ();
   g_source_set_priority (source, G_PRIORITY_HIGH);
   adata.client = client;
-  adata.thread = sfi_thread_self ();
   g_source_set_callback (source, async_create_context, &adata, NULL);
   g_source_attach (source, bse_main_context);
   g_source_unref (source);
-  /* wake up BSE thread */
+  // wake up BSE thread
   g_main_context_wakeup (bse_main_context);
-  /* wait til context creation */
-  do
-    sfi_thread_sleep (-1);
-  while (!adata.context);
-  return adata.context;
+  // receive result asynchronously
+  SfiGlueContext *context = adata.result_queue.pop();
+  return context;
 }
 
 void
diff --git a/bse/bsemain.hh b/bse/bsemain.hh
index a66f4c1..7b64046 100644
--- a/bse/bsemain.hh
+++ b/bse/bsemain.hh
@@ -7,11 +7,8 @@ G_BEGIN_DECLS
 
 // == BSE Initialization ==
 void           bse_init_textdomain_only (void);
-void           bse_init_async          (gint           *argc,
-                                        gchar        ***argv,
-                                        const char     *app_name,
-                                        SfiInitValue    values[]);             // prototyped in bse.hh
-SfiGlueContext* bse_init_glue_context  (const gchar    *client);               // prototyped in bse.hh
+void           _bse_init_async          (int *argc, char ***argv, const char *app_name, SfiInitValue 
values[]);
+SfiGlueContext* _bse_glue_context_create (const char *client, const std::function<void()> &caller_wakeup);
 const char*     bse_check_version      (guint           required_major,
                                          guint          required_minor,
                                          guint          required_micro);       // prototyped in bse.hh
diff --git a/sfi/sficomport.cc b/sfi/sficomport.cc
index 3cbca2e..1827bfc 100644
--- a/sfi/sficomport.cc
+++ b/sfi/sficomport.cc
@@ -13,6 +13,7 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 static SFI_MSG_TYPE_DEFINE (debug_comport, "comport", SFI_MSG_DEBUG, NULL);
+#undef DEBUG // FIXME
 #define DEBUG(...)              sfi_debug (debug_comport, __VA_ARGS__)
 #define MASS_DEBUG(...) // DEBUG (__VA_ARGS__)          // log every communicated value
 /* define the io bottle neck (for writes) to a small value
@@ -97,23 +98,18 @@ sfi_com_port_from_pipe (const gchar *ident,
                                  -1);
 }
 void
-sfi_com_port_create_linked (const gchar *ident1,
-                           BirnetThread   *thread1,
-                           SfiComPort **port1,
-                           const gchar *ident2,
-                           BirnetThread   *thread2,
-                           SfiComPort **port2)
+sfi_com_port_create_linked (const gchar *ident1, std::function<void()> wakeup1, SfiComPort **port1,
+                           const gchar *ident2, std::function<void()> wakeup2, SfiComPort **port2)
 {
   SfiComPortLink *link;
-  g_return_if_fail (thread1 && ident1);
-  g_return_if_fail (thread2 && ident2);
+  g_return_if_fail (wakeup1 && ident1);
+  g_return_if_fail (wakeup2 && ident2);
   g_return_if_fail (port1 && port2);
-  link = g_new0 (SfiComPortLink, 1);
-  sfi_mutex_init (&link->mutex);
+  link = new SfiComPortLink();
   link->port1 = sfi_com_port_from_child (ident1, -1, -1, -1);
-  link->thread1 = thread1;
+  link->wakeup1 = wakeup1;
   link->port2 = sfi_com_port_from_child (ident2, -1, -1, -1);
-  link->thread2 = thread2;
+  link->wakeup2 = wakeup2;
   link->ref_count = 2;
   link->port1->link = link;
   link->port1->connected = TRUE;
@@ -121,7 +117,6 @@ sfi_com_port_create_linked (const gchar *ident1,
   link->port2->connected = TRUE;
   *port1 = link->port1;
   *port2 = link->port2;
-  sfi_cond_init (&link->wcond);
 }
 static void
 sfi_com_port_link_destroy (SfiComPortLink *link)
@@ -132,9 +127,7 @@ sfi_com_port_link_destroy (SfiComPortLink *link)
     sfi_value_free ((GValue*) sfi_ring_pop_head (&link->p1queue));
   while (link->p2queue)
     sfi_value_free ((GValue*) sfi_ring_pop_head (&link->p2queue));
-  sfi_mutex_destroy (&link->mutex);
-  sfi_cond_destroy (&link->wcond);
-  g_free (link);
+  delete link;
 }
 SfiComPort*
 sfi_com_port_ref (SfiComPort *port)
@@ -210,21 +203,21 @@ sfi_com_port_close_remote (SfiComPort *port,
   if (port->link)
     {
       SfiComPortLink *link = port->link;
-      gboolean need_destroy;
-      sfi_mutex_lock (&link->mutex);
+      bool need_destroy;
+      link->mutex.lock();
       if (port == link->port1)
        {
          link->port1 = NULL;
-         link->thread1 = NULL;
+         link->wakeup1 = NULL;
        }
       else
        {
          link->port2 = NULL;
-         link->thread2 = NULL;
+         link->wakeup2 = NULL;
        }
       link->ref_count--;
       need_destroy = link->ref_count == 0;
-      sfi_mutex_unlock (&link->mutex);
+      link->mutex.unlock();
       port->link = NULL;
       if (need_destroy)
        sfi_com_port_link_destroy (port->link);
@@ -335,23 +328,23 @@ sfi_com_port_send_bulk (SfiComPort   *port,
       SfiComPortLink *link = port->link;
       gboolean first = port == link->port1;
       SfiRing *target = NULL;
-      BirnetThread *thread = NULL;
+      std::function<void()> wakeup;
       /* guard caller against receiver messing with value */
       for (ring = value_ring; ring; ring = sfi_ring_next (ring, value_ring))
         target = sfi_ring_append (target, sfi_value_clone_deep ((GValue*) ring->data));
-      sfi_mutex_lock (&link->mutex);
+      link->mutex.lock();
       if (first)
        link->p1queue = sfi_ring_concat (link->p1queue, target);
       else
        link->p2queue = sfi_ring_concat (link->p2queue, target);
       if (link->waiting)
-       sfi_cond_signal (&link->wcond);
+        link->wcond.signal();
       else
-       thread = first ? link->thread2 : link->thread1;
-      sfi_mutex_unlock (&link->mutex);
+       wakeup = first ? link->wakeup2 : link->wakeup1;
+      link->mutex.unlock();
       MASS_DEBUG ("[%s: sent values]", port->ident);
-      if (thread)
-       sfi_thread_wakeup (thread);
+      if (wakeup)
+        wakeup();
     }
   else
     for (ring = value_ring; ring; ring = sfi_ring_next (ring, value_ring))
@@ -516,7 +509,7 @@ sfi_com_port_recv_intern (SfiComPort *port,
   if (!port->rvalues && port->link)
     {
       SfiComPortLink *link = port->link;
-      sfi_mutex_lock (&link->mutex);
+      link->mutex.lock();
     refetch:
       if (port == link->port1)
        port->rvalues = link->p2queue, link->p2queue = NULL;
@@ -525,11 +518,11 @@ sfi_com_port_recv_intern (SfiComPort *port,
       if (!port->rvalues && blocking)
        {
          link->waiting = TRUE;
-         sfi_cond_wait (&link->wcond, &link->mutex);
+         link->wcond.wait (link->mutex);
          link->waiting = FALSE;
          goto refetch;
        }
-      sfi_mutex_unlock (&link->mutex);
+      link->mutex.unlock();
     }
   else if (!port->rvalues)
     {
diff --git a/sfi/sficomport.hh b/sfi/sficomport.hh
index 7f58589..233ed8a 100644
--- a/sfi/sficomport.hh
+++ b/sfi/sficomport.hh
@@ -1,15 +1,19 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
 #ifndef __SFI_COM_PORT_H__
 #define __SFI_COM_PORT_H__
+
 #include <sfi/sfitypes.hh>
 #include <sfi/sfiring.hh>
+
 G_BEGIN_DECLS
+
 #define        SFI_COM_PORT_MAGIC      (0x42534500 /* "BSE\0" */)
-typedef struct _SfiComPortLink SfiComPortLink;
-typedef struct _SfiComPort     SfiComPort;
-typedef void (*SfiComPortClosedFunc)   (SfiComPort     *port,
-                                        gpointer        close_data);
-struct _SfiComPort {
+
+struct SfiComPort;
+struct SfiComPortLink;
+typedef void (*SfiComPortClosedFunc) (SfiComPort *port, void *close_data);
+
+struct SfiComPort {
   gchar    *ident;
   guint     ref_count;
   GPollFD   pfd[2];    /* 0 = remote in, 1 = remote out */
@@ -41,19 +45,21 @@ struct _SfiComPort {
   gint     exit_code;
   gint     exit_signal;
 };
-struct _SfiComPortLink
+
+struct SfiComPortLink
 {
-  BirnetMutex    mutex;
-  guint       ref_count;
-  SfiComPort *port1;
-  BirnetThread  *thread1;
-  SfiComPort *port2;
-  BirnetThread  *thread2;
-  SfiRing    *p1queue;
-  SfiRing    *p2queue;
-  gboolean    waiting;
-  BirnetCond     wcond;
+  Rapicorn::Mutex       mutex;
+  guint                 ref_count;
+  SfiComPort           *port1;
+  std::function<void()> wakeup1;
+  SfiComPort           *port2;
+  std::function<void()> wakeup2;
+  SfiRing              *p1queue;
+  SfiRing              *p2queue;
+  Rapicorn::Cond        wcond;
+  bool                  waiting;
 };
+
 /* create ports */
 SfiComPort*    sfi_com_port_from_pipe          (const gchar    *ident,
                                                 gint            remote_input,
@@ -64,10 +70,10 @@ SfiComPort* sfi_com_port_from_child         (const gchar    *ident,
                                                 gint            remote_pid);
 /* create linked ports */
 void           sfi_com_port_create_linked      (const gchar    *ident1,
-                                                BirnetThread   *thread1,
+                                                 std::function<void()> wakeup1,
                                                 SfiComPort    **port1,
                                                 const gchar    *ident2,
-                                                BirnetThread   *thread2,
+                                                 std::function<void()> wakeup2,
                                                 SfiComPort    **port2);
 SfiComPort*    sfi_com_port_ref                (SfiComPort     *port);
 void           sfi_com_port_unref              (SfiComPort     *port);
@@ -92,5 +98,7 @@ void          sfi_com_port_close_remote       (SfiComPort     *port,
 void           sfi_com_port_reap_child         (SfiComPort     *port,
                                                 gboolean        kill_child);
 gboolean       sfi_com_port_test_reap_child    (SfiComPort     *port);
+
 G_END_DECLS
+
 #endif /* __SFI_COM_PORT_H__ */
diff --git a/shell/bsescm.cc b/shell/bsescm.cc
index bf11ab2..b4e3261 100644
--- a/shell/bsescm.cc
+++ b/shell/bsescm.cc
@@ -78,8 +78,8 @@ main (int   argc,
   if (!bse_scm_context)
     {
       /* start our own core thread */
-      bse_init_async (&argc, &argv, "BSESCM", NULL);
-      bse_scm_context = bse_init_glue_context (PRG_NAME);
+      Bse::init_async (&argc, &argv, "BSESCM", NULL);
+      bse_scm_context = Bse::init_glue_context (PRG_NAME, []() { g_main_context_wakeup 
(g_main_context_default()); });
     }
   /* now that the BSE thread runs, drop scheduling priorities if we have any */
   setpriority (PRIO_PROCESS, getpid(), 0);
@@ -289,7 +289,7 @@ shell_parse_args (gint    *argc_p,
   *argc_p = e;
   if (initialize_bse_and_exit)
     {
-      bse_init_async (argc_p, argv_p, "BSESCM", NULL);
+      Bse::init_async (argc_p, argv_p, "BSESCM", NULL);
       exit (0);
     }
 }
diff --git a/tests/bse/cxxbinding.cc b/tests/bse/cxxbinding.cc
index f650278..fe66741 100644
--- a/tests/bse/cxxbinding.cc
+++ b/tests/bse/cxxbinding.cc
@@ -20,9 +20,9 @@ main (int   argc,
       char *argv[])
 {
   std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
-  bse_init_async (&argc, &argv, "CxxBindingTest", NULL);
+  Bse::init_async (&argc, &argv, "CxxBindingTest", NULL);
   sfi_msg_allow ("misc");
-  bse_context = bse_init_glue_context (argv[0]);
+  bse_context = Bse::init_glue_context (argv[0], []() { g_main_context_wakeup (g_main_context_default()); });
   sfi_glue_context_push (bse_context);
   g_print ("type_blurb(BseContainer)=%s\n", type_blurb("BseContainer").c_str());
   const gchar *file_name = "empty.ogg";
diff --git a/tests/perftest.cc b/tests/perftest.cc
index c639894..bc5d61e 100644
--- a/tests/perftest.cc
+++ b/tests/perftest.cc
@@ -15,12 +15,12 @@ gettime ()
   gettimeofday (&tv, 0);
   return double(tv.tv_sec) + double(tv.tv_usec) * (1.0 / 1000000.0);
 }
-int main(int argc, char **argv)
+int main (int argc, char **argv)
 {
   std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
-  bse_init_async (&argc, &argv, "Perftest", NULL);
+  Bse::init_async (&argc, &argv, "Perftest", NULL);
   sfi_msg_allow ("misc");
-  bse_context = bse_init_glue_context (argv[0]);
+  bse_context = Bse::init_glue_context (argv[0], []() { g_main_context_wakeup (g_main_context_default()); });
   sfi_glue_context_push (bse_context);
   printf ("%s: testing remote glue layer calls via C++ interface:\n", argv[0]);
   const int max_calls = 30000;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]