Files
federated-calendar/src/core/gcal-global.c
T
Georges Basile Stavracas Neto df66e484a7 core: Add global threading utility
For now, we only store what's the main thread of the program.
2023-08-22 17:25:56 -03:00

48 lines
1.2 KiB
C

/*
* gcal-global.c
*
* Copyright 2023 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include "gcal-global.h"
#include "gconstructor.h"
static GThread *main_thread;
#if defined (G_HAS_CONSTRUCTORS)
# ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
# pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(gcal_init_ctor)
# endif
G_DEFINE_CONSTRUCTOR(gcal_init_ctor)
#else
# error Your platform/compiler is missing constructor support
#endif
static void
gcal_init_ctor (void)
{
main_thread = g_thread_self ();
}
GThread *
gcal_get_main_thread (void)
{
return main_thread;
}