Commit graph

91 commits

Author SHA1 Message Date
Seungha Yang
f0d003205c task: Use SetThreadDescription Win32 API for setting thread name
Since Windows 10 1607, we can make use of SetThreadDescription() API
for setting thread name. Unlike previously used exception based
method, this API will preserve configured thread name on dump file.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/735>
2021-01-14 18:33:42 +00:00
Edward Hervey
31e6d766ff gst: Delay creation of threadpools
Since glib 2.64, gthreadpool will start waiting on a GCond immediately upon
creation. This can cause issues if we fork *before* actually using the
threadpool since we will then be signalling that GCond ... from another process
and that will never work.

Instead, delay creationg of thread pools until the very first time we need
them. This introduces a minor (un-noticeable) delay when needing a new thread
but fixes the issues for all users of GSTreamer that will call gst_init, then
fork and actually start pipelines.

See https://gitlab.gnome.org/GNOME/glib/-/issues/2131 for more context.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/531>
2020-06-16 08:23:21 +02:00
Nicolas Dufresne
e272ae281f task: Introduce gst_task_resume() API
This new API allow resuming a task if it was paused, while leaving it to
stopped stated if it was stopped or not started yet. This new API can be
useful for callback driver workflow, where you basically want to pause and
resume the task when buffers are notified while avoiding the race with a
gst_task_stop() coming from another thread.
2020-04-01 15:13:59 +00:00
Tim-Philipp Müller
2db8e3705f Update for g_type_class_add_private() deprecation in recent GLib
https://gitlab.gnome.org/GNOME/glib/merge_requests/7
2018-06-24 12:49:14 +02:00
Sebastian Dröge
daa98fc02a gst: Don't ref_sink() GstObject subclasses in instance_init/constructor
This is something bindings can't handle and it causes leaks. Instead
move the ref_sink() to the explicit, new() constructors.

This means that abstract classes, and anything that can have subclasses,
will have to do ref_sink() in their new() function now. Specifically
this affects GstClock and GstControlSource.

https://bugzilla.gnome.org/show_bug.cgi?id=743062
2017-05-17 10:40:37 +03:00
Tim-Philipp Müller
519d64881f Don't use deprecated g_object_newv()
Use g_object_new() instead which nowadays has a shortcut for the
no-properties check. It still does an extra GType check in the
function guard, but there's a pending patch to remove that
and it's hardly going to be a performance issue in practice,
even less so on a system that's compiled without run-time checks.

Alternative would be to move to the new g_object_new_properties()
with a fallback define for older glib versions, but it makes the
code look more unwieldy and doesn't seem worth it.

Fixes deprecation warnings when building against newer GLib versions.

https://bugzilla.gnome.org/show_bug.cgi?id=780903
2017-04-08 09:49:59 +01:00
Thibault Saunier
a87b4551a6 Port gtk-doc comments to their equivalent markdown syntax
Modernizing our documentation and preparing a possible move to hotdoc.
This commits also adds missing @title metadatas to all SECTIONs
2017-01-27 16:36:38 -03:00
Scott D Phillips
5a72c23a54 Change some types to match their prototypes
Particularly note that the underlying integer type of the enum
GstTypeFindProbability is implementation dependent and may not match
guint.

https://bugzilla.gnome.org/show_bug.cgi?id=774293
2016-11-14 21:03:57 +02:00
Guillaume Desmottes
40727d9c83 element: clean up thread pool from gst_task_cleanup_all()
This ensures that all async operations (started from gst_element_call_async())
have been completed and so there is no extra thread running.

Fix races when checking for leaks on unit tests as some of those
operations were still running when the leaks tracer was checking for
leaked objects.

https://bugzilla.gnome.org/show_bug.cgi?id=768577
2016-07-08 17:27:32 +01:00
Guillaume Desmottes
4a41468ce7 Use MAY_BE_LEAKED_FLAG
This helps having "make check" passing with the leaks tracer enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=766008
2016-06-02 23:14:15 +01:00
Nirbheek Chauhan
806dbeeef3 Whenever we include windows.h, also define WIN32_LEAN_AND_MEAN
This reduces the number of symbols and code pulled in drastically
2016-02-20 10:07:42 +00:00
Prashant Gotarne
3cea60dc6f task: add function guard for _set_lock() and fix guard for _join()
Should only access the object structure after checking
it's valid in gst_task_join().

https://bugzilla.gnome.org/show_bug.cgi?id=746385
https://bugzilla.gnome.org/show_bug.cgi?id=746431
2015-07-13 14:16:52 +01:00
Prashant Gotarne
03dccde1ef task: guard against NULL task function
https://bugzilla.gnome.org/show_bug.cgi?id=746439
2015-06-25 09:56:19 +01:00
Nicolas Dufresne
2b7a15172f build: Check that _MSC_VER macro is defined 2015-02-01 14:23:26 -05:00
Ilya Konstantinov
05296b35a5 task: Add thread name support on OS X and iOS 2015-02-01 20:11:20 +01:00
Haakon Sporsheim
6c079367f1 task: Fix pause/stop race condition
If a task thread is calling pause on it self and the
controlling/"main" thread stops the task, it could end in a race
where gst_task_func loops and then checks for paused after the
controlling thread just changed the task state to stopped.
Hence the task would actually call func again even though it was
both paused and stopped.

https://bugzilla.gnome.org/show_bug.cgi?id=740001
2014-11-12 12:00:48 +01:00
Evan Nemerson
e10266e3f3 docs: convert NULL, TRUE, and FALSE to %NULL, %TRUE, and %FALSE
This should help improve documentation generated for
languages other than C.

https://bugzilla.gnome.org/show_bug.cgi?id=730961
2014-05-30 00:20:27 +01:00
Tim-Philipp Müller
6eb6d9ec38 docs: remove outdated and pointless 'Last reviewed' lines from docs
They are very confusing for people, and more often than not
also just not very accurate. Seeing 'last reviewed: 2005' in
your docs is not very confidence-inspiring. Let's just remove
those comments.
2014-04-26 21:21:51 +01:00
Brendan Long
f85c1c4648 gst: clear floating references for GstTask, GstTaskPool and GstCollectPads
https://bugzilla.gnome.org/show_bug.cgi?id=710342
2014-02-06 22:50:53 +01:00
Philippe Normand
de58036de5 task: documentation update
GStaticRecMutex usage has been replaced by GRecMutex, reflect this
change in the documentation.
2012-11-14 12:25:30 +01:00
Tim-Philipp Müller
666c8c11c6 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 20:44:48 +00:00
Edward Hervey
d3ffa82639 Remove 0.10-related documentation and "Since" markers 2012-07-10 12:03:27 +02:00
Wim Taymans
b2aa56f4e3 task: add separate methods to add enter/leave callback
Remove the structure of callbacks and replace with separate methods to register
each callback. This is much more binding friendly.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=677898
2012-06-20 11:59:09 +02:00
Wim Taymans
76e8b2ecda task: add GDestroyNotify to _new
Add a GDestroyNotify to the user_data we pass to gst_task_new()
Change gst_pad_start_task() to also take the notify
2012-06-20 10:31:49 +02:00
Tim-Philipp Müller
0cfc3cf8a2 task: remove gst_task_set_priority()
It doesn't actually do anything.
2012-04-08 21:17:46 +01:00
Wim Taymans
ce67b0e539 docs: update more documentation 2012-03-29 13:34:50 +02:00
Tim-Philipp Müller
e09fe53a22 Merge remote-tracking branch 'origin/master' into 0.11
Conflicts:
	common
	gst/gstpad.h
	gst/gsttask.c
	libs/gst/base/gstcollectpads2.h
2012-03-08 19:55:30 +00:00
Tim-Philipp Müller
4d2adb0249 pad, task: improve debug logging 2012-03-08 16:30:49 +00:00
Wim Taymans
592ead764c task: add more debug 2012-02-15 12:18:38 +01:00
Tim-Philipp Müller
2c8c44976f Replace deprecated GStaticMutex with GMutex
https://bugzilla.gnome.org/show_bug.cgi?id=662207
2012-01-22 22:44:59 +00:00
Tim-Philipp Müller
13d91d1f6c Use recent GLib API unconditionally now that we depend on the latest GLib 2012-01-22 01:25:22 +00:00
Wim Taymans
252327f87a Update for new gthread API 2012-01-19 09:27:04 +01:00
Tim-Philipp Müller
a1daf846f3 Merge remote-tracking branch 'origin/master' into 0.11
Conflicts:
	gst/gstobject.h
	libs/gst/check/gstcheck.h
	libs/gst/controller/gstcontroller.c
	plugins/elements/gstidentity.c
	tools/gst-xmlinspect.c
2011-12-04 15:38:09 +00:00
Tim-Philipp Müller
2666450864 Suppress deprecation warnings in selected files, for g_static_rec_mutex_* mostly
GStaticRecMutex is part of our API/ABI, not much we can do here in 0.10.
2011-12-04 14:38:26 +00:00
Tim-Philipp Müller
5889260d5a Work around deprecated thread API in glib master
Add private replacements for deprecated functions such as
g_mutex_new(), g_mutex_free(), g_cond_new() etc., mostly
to avoid the deprecation warnings. We can't change most of
these in 0.10 because they're part of our API and ABI.
2011-12-04 13:35:38 +00:00
Wim Taymans
2cb971589d task: don't use lock/unlock_full 2011-11-03 14:14:54 +01:00
Wim Taymans
d9dc9f9d52 task: api cleanup
gst_task_create() -> gst_task_new()
2011-11-02 08:59:44 +01:00
Wim Taymans
5cf8e68944 Merge branch 'master' into 0.11
Conflicts:
	gst/gstmessage.c
	gst/gstquery.c
	gst/gstregistrychunks.c
	gst/gstsegment.c
	libs/gst/base/gstbasetransform.c
	libs/gst/base/gstbasetransform.h
	libs/gst/base/gsttypefindhelper.c
	plugins/elements/gsttypefindelement.c
2011-08-26 14:37:54 +02:00
Josep Torra
97442ad1a3 task: explicitly cast to the enum type
Fixes warning #188: enumerated type mixed with another type reported by ICC.
2011-08-26 14:11:14 +02:00
Wim Taymans
b171259612 Merge branch 'master' into 0.11
Conflicts:
	libs/gst/base/gstbasesrc.c
2011-07-07 11:13:19 +02:00
Emmanuel Pacaud
156583a69c task: Check for PR_SET_NAME before using
Fixes: #653172.

Signed-off-by: David Schleef <ds@schleef.org>
2011-06-25 13:52:28 -07:00
Wim Taymans
5dd9ab1cab cleanups
Fix padding, remove deprecated symbols.
2011-02-22 16:04:12 +01:00
Tim-Philipp Müller
3256c708be docs: gst: more gobject introspection annotations
Many of these are superfluous, added for clarity.
2010-12-07 18:37:04 +00:00
Wim Taymans
1e1872137d task: avoid task lock for each iteration
Make the task state an atomic variable so that we can avoid taking and releasing
the task lock for each iteration.
2010-12-03 11:21:03 +01:00
David Hoyt
7199a4f1ff gsttask: Set thread names on Windows with MSVC if a debugger is attached
Fixes bug #632168.
2010-12-02 19:02:08 +01:00
Stefan Kost
5ff43184cf task: snprintf needs to include "stdio.h" 2010-03-16 09:56:41 +02:00
Wim Taymans
c78c637a77 task: use bionic/libc friendly arguments to prctl
prctl is supposed to take 5 arguments. It used to work with 2 arguments on some
versions of libc because it is defined as a varags function there.

See #611911
2010-03-15 17:07:59 +01:00
Wim Taymans
fb9243178a task: update docs. 2010-03-15 15:12:01 +01:00
Wim Taymans
f9c74afe62 task: configure the object name as thread name
When we have prctl available, use it to set the configured object name as the
thread name for better debugging.

Based on patch by Robert Swain.
2010-03-15 14:48:19 +01:00
Benjamin Otte
e8f65e8bff Make code safe for -Wredundant-decls
Adds that warning to configure.ac

Includes a tiny change of the GST_BOILERPLATE_FULL() macro:
The get_type() function is no longer declared before being defined.

https://bugzilla.gnome.org/show_bug.cgi?id=611692
2010-03-10 20:45:33 +01:00