implement _destroy, and fix some bugs changing songs in the player doesn't work now, i don't know why yet

Original commit message from CVS:
implement _destroy, and fix some bugs

changing songs in the player doesn't work now, i don't know why yet
This commit is contained in:
Andy Wingo 2002-06-23 04:31:45 +00:00
parent d3e33a16ac
commit 16074b7263
2 changed files with 30 additions and 29 deletions

View file

@ -2,7 +2,7 @@
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be> * 2000 Wim Taymans <wtay@chello.be>
* *
* gstscheduler.c: Default scheduling code for most cases * cothreads_compat.h: Compatibility macros between cothreads packages
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -44,15 +44,15 @@ typedef cothread_state cothread;
#define do_cothread_switch(to) cothread_switch(to) #define do_cothread_switch(to) cothread_switch(to)
#define do_cothread_create(new_thread, context, func, argc, argv) \ #define do_cothread_create(new_thread, context, func, argc, argv) \
G_STMT_START{ \ G_STMT_START{ \
new_thread = cothread_create (context); \ new_thread = cothread_create (context); \
if (new_thread) { \ if (new_thread) { \
cothread_setfunc (new_thread, (func), (argc), (argv)); \ cothread_setfunc (new_thread, (func), (argc), (argv)); \
}\ } \
}G_STMT_END }G_STMT_END
#define do_cothread_setfunc(cothread, context, func, argc, argv) \ #define do_cothread_setfunc(cothread, context, func, argc, argv) \
cothread_setfunc ((cothread), (func), (argc), (argv)) cothread_setfunc ((cothread), (func), (argc), (argv))
#define do_cothread_destroy(cothread) cothread_free(cothread) #define do_cothread_destroy(cothread) cothread_free(cothread)
@ -88,34 +88,35 @@ typedef cothread cothread_context;
/* define functions /* define functions
* the macros are prepended with "do_" * the macros are prepended with "do_"
*/ */
#define do_cothreads_init(x) G_STMT_START{ \ #define do_cothreads_init(x) G_STMT_START{ \
if (!cothreads_initialized()) \ if (!cothreads_initialized()) \
cothreads_init(0x0200000, 16); \ cothreads_init(0x0200000, 16); \
}G_STMT_END }G_STMT_END
#define do_cothreads_stackquery(stack,size) \ #define do_cothreads_stackquery(stack,size) \
cothreads_alloc_thread_stack (stack, size) cothreads_alloc_thread_stack (stack, size)
#define do_cothread_switch(to) G_STMT_START{ \ #define do_cothread_switch(to) G_STMT_START{ \
cothread *from = cothread_self (); \ cothread *from = cothread_self (); \
if (from == (to)) { \ if (from == (to)) { \
GST_DEBUG (GST_CAT_COTHREAD_SWITCH, "trying to switch to the same cothread (%p), not allowed", \ GST_DEBUG (GST_CAT_COTHREAD_SWITCH, \
(to)); \ "trying to switch to the same cothread (%p), not allowed", \
g_warning ("trying to switch to the same cothread, not allowed"); \ (to)); \
} else { \ g_warning ("trying to switch to the same cothread, not allowed"); \
GST_INFO (GST_CAT_COTHREAD_SWITCH, "switching from cothread %p to cothread %p", \ } else { \
from, (to)); \ GST_INFO (GST_CAT_COTHREAD_SWITCH, \
cothread_switch (from, (to)); \ "switching from cothread %p to cothread %p", from, (to)); \
GST_INFO (GST_CAT_COTHREAD_SWITCH, "we're in cothread %p now", from); \ cothread_switch (from, (to)); \
} \ GST_INFO (GST_CAT_COTHREAD_SWITCH, "we're in cothread %p now", from); \
} \
}G_STMT_END }G_STMT_END
#define do_cothread_create(new_thread, context, func, argc, argv) \ #define do_cothread_create(new_thread, context, func, argc, argv) \
G_STMT_START{ \ G_STMT_START{ \
new_thread = cothread_create ((func), 0, (void**) (argv), (context)); \ new_thread = cothread_create ((func), 0, (void**) (argv), (context)); \
}G_STMT_END }G_STMT_END
#define do_cothread_setfunc(cothread, context, func, argc, argv) \ #define do_cothread_setfunc(cothread, context, func, argc, argv) \
cothread_setfunc ((cothread), (func), (argc), (void **) (argv), (context)) cothread_setfunc ((cothread), (func), (argc), (void **) (argv), (context))
#define do_cothread_destroy(cothread) cothread_destroy(cothread) #define do_cothread_destroy(cothread) cothread_destroy(cothread)

View file

@ -245,7 +245,7 @@ plugin_init (GModule *module, GstPlugin *plugin)
gst_plugin_set_longname (plugin, "A basic scheduler"); gst_plugin_set_longname (plugin, "A basic scheduler");
factory = gst_scheduler_factory_new (COTHREADS_NAME, factory = gst_scheduler_factory_new (COTHREADS_NAME,
"A basic scheduler, it uses "COTHREADS_NAME" cothreads", "A basic scheduler using "COTHREADS_NAME" cothreads",
gst_basic_scheduler_get_type()); gst_basic_scheduler_get_type());
if (factory != NULL) { if (factory != NULL) {