⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pthreads_win32.c

📁 在AVR单片机上使用的一款RTOS
💻 C
字号:
/*
 * -------------------------------------------------------------
 *
 * Module: semaphore.c
 *
 * Purpose:
 *	Concatenated version of separate modules to allow
 *	inlining optimisation, which it is assumed can only
 *	be effective within a single module.
 *
 *	Semaphores aren't actually part of the PThreads standard.
 *	They are defined by the POSIX Standard:
 *
 *		POSIX 1003.1b-1993	(POSIX.1b)
 *
 * -------------------------------------------------------------
 *
 * --------------------------------------------------------------------------
 *
 *      Pthreads-win32 - POSIX Threads Library for Win32
 *      Copyright(C) 1998 John E. Bossom
 *      Copyright(C) 1999,2005 Pthreads-win32 contributors
 * 
 *      Contact Email: rpj@callisto.canberra.edu.au
 * 
 *      The current list of contributors is contained
 *      in the file CONTRIBUTORS included with the source
 *      code distribution. The list can also be seen at the
 *      following World Wide Web location:
 *      http://sources.redhat.com/pthreads-win32/contributors.html
 * 
 *      This library is free software; you can redistribute it and/or
 *      modify it under the terms of the GNU Lesser General Public
 *      License as published by the Free Software Foundation; either
 *      version 2 of the License, or (at your option) any later version.
 * 
 *      This library 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
 *      Lesser General Public License for more details.
 * 
 *      You should have received a copy of the GNU Lesser General Public
 *      License along with this library in the file COPYING.LIB;
 *      if not, write to the Free Software Foundation, Inc.,
 *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 */
/*!!!!!!!!ONLY ON WINDOWS!!!!!!!!!!!!!*/
#ifdef	__MINGW32__

#define PTW32_STATIC_LIB

#ifndef _UWIN
#   include <process.h>
#endif

#ifndef NEED_FTIME
#  include <sys/timeb.h>
#endif



#include <limits.h>

#include "arch/win32/pthread.h"
#include "arch/win32/semaphore.h"
#include "arch/win32/implement.h"

/*some utilites*/
#include "arch/win32/cleanup.c"
/*some utilites may be they can be cuted*/
#include "arch/win32/global.c"


/* Must be first to define HAVE_INLINABLE_INTERLOCKED_CMPXCHG */
#include "ptw32_InterlockedCompareExchange.c"
/*
#include "ptw32_MCS_lock.c"
#include "ptw32_is_attr.c"
#include "ptw32_processInitialize.c"
#include "ptw32_processTerminate.c"
#include "ptw32_threadStart.c"
#include "ptw32_threadDestroy.c"

#include "ptw32_callUserDestroyRoutines.c"
#include "ptw32_semwait.c"
#include "ptw32_timespec.c"
#include "ptw32_relmillisecs.c"
#include "ptw32_throw.c"
#include "ptw32_getprocessors.c"
*/
#include "arch/win32/ptw32_tkAssocCreate.c"
#include "arch/win32/ptw32_tkAssocDestroy.c"
#include "arch/win32/ptw32_new.c"
#include "arch/win32/ptw32_throw.c"
#include "arch/win32/pthread_win32_attach_detach_np.c"
#include "arch/win32/ptw32_processTerminate.c"
#include "arch/win32/ptw32_processInitialize.c"
#include "arch/win32/ptw32_threadDestroy.c"
#include "arch/win32/ptw32_callUserDestroyRoutines.c"
#include "arch/win32/ptw32_reuse.c"
#include "arch/win32/pthread_key_create.c"
#include "arch/win32/pthread_key_delete.c"
#include "arch/win32/pthread_cancel.c"
#include "arch/win32/w32_CancelableWait.c"
#include "arch/win32/pthread_kill.c"
#include "arch/win32/pthread_mutex_destroy.c"
#include "arch/win32/pthread_mutex_trylock.c"
#include "arch/win32/ptw32_mutex_check_need_init.c"
#include "arch/win32/pthread_self.c"
#include "arch/win32/pthread_setspecific.c"
#include "arch/win32/pthread_getspecific.c"
#include "arch/win32/pthread_testcancel.c"
#include "arch/win32/pthread_equal.c"
#include "arch/win32/ptw32_threadStart.c"
#include "arch/win32/pthread_setschedparam.c"
#include "arch/win32/sched_get_priority_max.c"
#include "arch/win32/sched_get_priority_min.c"


/*functions that is needed fo this project*/
#include "arch/win32/create.c"
#include "arch/win32/pthread_mutex_init.c"
#include "arch/win32/pthread_mutex_lock.c"
#include "arch/win32/pthread_mutex_unlock.c"

#include "arch/win32/sem_init.c"
#include "arch/win32/sem_wait.c"
#include "arch/win32/sem_post.c"

/*#include "sem_destroy.c"
#include "sem_trywait.c"

#include "sem_timedwait.c"
#include "sem_post_multiple.c"
#include "sem_getvalue.c"
#include "sem_open.c"
#include "sem_close.c"
#include "sem_unlink.c"
*/
/*unsigned long long rdtsc()
{
  #define rdtsc(low, high) \
         __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))

  unsigned long low, high;
  rdtsc(low, high);
  return ((unsigned long long)high << 32) | low;
}*/


#endif /*#ifdef	__MINGW32__*/
/*!!!!!!!!ONLY ON WINDOWS!!!!!!!!!!!!!*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -