From patchwork Fri Aug 18 16:14:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 43262 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4c9d:b0:130:ccc6:6c4b with SMTP id fq29csp2780498pzb; Fri, 18 Aug 2023 09:14:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE5uOHCtPfaOr49rGNPuZiRVVgm/ZyTEnomtSxnVkF4Nqam/NB7iL69sN7UGZxGHDKI+ryx X-Received: by 2002:a2e:3010:0:b0:2b7:764:3caf with SMTP id w16-20020a2e3010000000b002b707643cafmr2217521ljw.10.1692375295765; Fri, 18 Aug 2023 09:14:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692375295; cv=none; d=google.com; s=arc-20160816; b=jFxEShDc+PbgJT30KTkdMBWAkhOhJeWlHhtIc8rQWgVw8QfyA/s/Mp2gx4fe6oQGSL ZbMyZUNeIW3AoA6QYdcozqCPl8yHQHRhG6Ef0jvU/cK09qOwFJ5TGai4yK2LJDlXn4Uv P/atngI5Dh4LJMKO+Wsfuo09MBFnH/4G4T5nbWK32LffjApPQJ3/yNZUrRinPHFnlSpA TCexVEo3tipH+5ohSGw44pUYPexxXIpChgGm73auWylzXKcSnCj6Y1cHeruMdh7dQwLe P7RimoUS/QYw2756mrLxZVfPO+5j1zf12clO0jBw2RkEkLwLg7dxnhiZb+MFm3hCsIDz VO0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=UFmTY/TZGVS2Tn3UpdDiQnIaQp/yQeEXxI1W+V3VWCE=; fh=J3zlMo7rVW2t2IQYogliBcMNuBh6YQg7NRChcrschf4=; b=IZ3Ay8t0rCNRJafsFCkhKA8D+NJ4+xj8VcEjvI8YZNoR/wfI/n04qQsIvpkqZHN5Mt 2bko5krRngXZUGFantf1gQLR1VBiCSK1i3sHMt/92VfTLDoPQbkrbgek9zibjOyfAX0u D9SdYxFbcHjf5VMchf/ZpmOLoL1CfqjWKgwxH+onRBe4FmzQMObxxGKE1jKBQUCwi09J tvLqww5Btf2VWCOCs/5RE1aBjZ9Y+eProYtlkF6WWH8mPPJKu/F4scU3+S/Hm05tq7Cb 4C/w/rJ+bI+oKSlC4/Ud+jO9A+ehJOYx2YAuzo8wOh2LUyN1tc2fGBh1KjDrVJaHW6jP ZIsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20221208 header.b=HiBzcMz3; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q18-20020a1709066ad200b0099bc7292ed0si1613345ejs.806.2023.08.18.09.14.44; Fri, 18 Aug 2023 09:14:55 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20221208 header.b=HiBzcMz3; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 884E968C642; Fri, 18 Aug 2023 19:14:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DD26368BECB for ; Fri, 18 Aug 2023 19:14:34 +0300 (EEST) Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3a751d2e6ecso758444b6e.0 for ; Fri, 18 Aug 2023 09:14:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692375273; x=1692980073; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=CVLvR3OlQNbvmB7+iJJHSQ6fjJjnT+YtxTan7+8VgFQ=; b=HiBzcMz37g27zoRP3zcKvulvXDaJwiiEm07AXWie6EIip01A3FCEtqUs5TESmybg3k A3Jkt/QaSdisYp5GxdzmGGWmBDWRBXz2npqyv4AUs0LODMIXzfcQJQzOHugJa/SadGbk SkZNKLrKtvl3Fjmj/BdxJwZZaPcxGP5fhJKMuyw5HimHgFgy2ed+mBsq+xra0HPSijZL 6XSm1I3yqztlMjwuRxhAkHvDfTPv1iVFBWnuCmO0Zt5Gu+Jhcmvz6z7J+Yk5RJ62BLPO 6CY7py1nL7UWCx+NNlHmY6DNMslBW8YV9a1iOuINSQ9nY7J6ngatJjStDQ4kYjltCZDg t6vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692375273; x=1692980073; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CVLvR3OlQNbvmB7+iJJHSQ6fjJjnT+YtxTan7+8VgFQ=; b=Aumte7jV0LoJgRYAm85EqvIRmgEkXy+OVTCcOsazybQvpdzsMT+s02RY51grg7z89G 6UGr/GoMcRbJcpe6YRr5to2r81zXwlJifbL1u2DmIjWVuDV9fTtLD1KOlN8TxfyMkbIu sVVeOhEGhBuWhnEXT5zKPJzu7s5PDHrcSFGEyRPhAD13Bhp70RNrShGSKxwUgMSNu9Pu IAJUBaWTw97/nZ0sHMSfyH5sCVzevDmRfJZc7MAeWvET/mkTE/Y1xyZ8g9vacx3lVvZF Tl+HBecP3G7JIdkikUdP7bBxSHyvcImuoKPAqDJyyUep6W7srdaXShTufY4wB2wPT5p0 oglw== X-Gm-Message-State: AOJu0Yzm2beviPIfzF073mC5hFMjNT6l4btU+ioD0hldA4ARhJsHATS0 kMOWANZnFC2RIzKlN6VfVQmn5wY+mf4= X-Received: by 2002:a05:6808:bd6:b0:3a8:43d5:878b with SMTP id o22-20020a0568080bd600b003a843d5878bmr1462307oik.2.1692375273184; Fri, 18 Aug 2023 09:14:33 -0700 (PDT) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id n3-20020a0568080a0300b003a463ded3a3sm997088oij.53.2023.08.18.09.14.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Aug 2023 09:14:32 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Fri, 18 Aug 2023 13:14:27 -0300 Message-ID: <20230818161427.3968-1-jamrial@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230818160656.3938-1-jamrial@gmail.com> References: <20230818160656.3938-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] avutil/thread: add wrappers for pthread_cond_t and pthread_t functions X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: fdiktdoZPAuT Signed-off-by: James Almer --- Now not defining pthread_t when !HAVE_THREADS, like it's done with cond, mutex, and once. libavutil/thread.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/libavutil/thread.h b/libavutil/thread.h index 2f5e7e1cb5..7dfa54c6a9 100644 --- a/libavutil/thread.h +++ b/libavutil/thread.h @@ -155,6 +155,15 @@ static inline int strict_pthread_once(pthread_once_t *once_control, void (*init_ #include "compat/w32pthreads.h" #endif +#define AVCond pthread_cond_t + +#define ff_cond_init pthread_cond_init +#define ff_cond_destroy pthread_cond_destroy +#define ff_cond_signal pthread_cond_signal +#define ff_cond_broadcast pthread_cond_broadcast +#define ff_cond_wait pthread_cond_wait +#define ff_cond_timedwait pthread_cond_timedwait + #define AVMutex pthread_mutex_t #define AV_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER @@ -168,8 +177,23 @@ static inline int strict_pthread_once(pthread_once_t *once_control, void (*init_ #define ff_thread_once(control, routine) pthread_once(control, routine) +#define AVThread pthread_t + +#define ff_thread_create pthread_create +#define ff_thread_join pthread_join + #else +#define AVCond char + +static inline int ff_cond_init(AVCond *cond, const void *attr){ return 0; } +static inline int ff_cond_destroy(AVCond *cond){ return 0; } +static inline int ff_cond_signal(AVCond *cond){ return 0; } +static inline int ff_cond_broadcast(AVCond *cond){ return 0; } +static inline int ff_cond_wait(AVCond *cond, AVMutex *mutex){ return 0; } +static inline int ff_cond_timedwait(AVCond *cond, AVMutex *mutex, + const void *abstime){ return 0; } + #define AVMutex char #define AV_MUTEX_INITIALIZER 0 @@ -190,6 +214,12 @@ static inline int ff_thread_once(char *control, void (*routine)(void)) return 0; } +#define AVThread char + +static inline int ff_thread_create(AVThread *thread, const void *unused_attr, + void *(*start_routine)(void*), void *arg){ return 0; } +static inline int ff_thread_join(AVThread thread, void **value_ptr){ return 0; } + #endif static inline int ff_thread_setname(const char *name)