Location:
Search - semaphore.h
Search list
Description: 1 本程序是我自己移植,只使用KEIL进行过软仿真,测试没有发现问题。支持从任何一个中断服务程序里释放信号量。
2 此代码作为参考和学习使用,如果在使用过程中造成损失,本人不负任何责任。
3 此代码作为参考和学习使用,因为里边有UCOS-II,如果要作为商业使用请给UCOS付费
欢迎大家测试,在实践中检验一下,多提提意见。谢谢,我会根据大家测试结果第一时间解决问题。
上一个版本发现了漏洞已经修正,已经在STM32F103CBT6上通过了测试: -A program is my own transplant, carried out using only soft KEIL simulation, testing did not find the problem. Support from any one of interrupt service routine release semaphore. 2 of this code as a reference and learning to use, if in the use of the process of loss, I no responsibility. 3 of this code as a reference and learning to use, because inside has UCOS-II, if we as a commercial use, please pay uCOS welcomes U.S. test, in practice, testing about more than make a suggestion. Thank you, I will in accordance with the first U.S. test results to solve the problem. The previous version has already found loopholes in the amendment has passed the test on STM32F103CBT6:
Platform: |
Size: 110592 |
Author: 姚军 |
Hits:
Description: Purpose
Aim to setup a small system above the OS layer , implement the message queue of process or thread and simulate the function of watchdog used to detect the deadlock of the system.
- introduction
1. Purpose
Aim to setup a small system above the OS layer , implement the message queue of process or thread and simulate the function of watchdog used to detect the deadlock of the system.
2. Method
Using window API to create serval thread and create a message queue for each thread to control the message exchange between the different treads.
3. Files
Projectmain.h------ structs , enums ,and claim of functions
ThreadSemaphore.c------- extend the Windows semaphore API
ThreadQueue.c------- message queue file (send to, receive from ,create and destroy queue )
ThreadFrame.c-- 1) create all the task for test
2) control the message handling
3) control the thread running
4)functions of watchdog
5) a hardware timer simulator to create timeout message every 1 sec
4 task :
Thread_IDLE,-- lowest prority , interact with user and obtain a semaphore which will be waitted by Thread_LOST later
Platform: |
Size: 1002496 |
Author: Xiwen |
Hits:
Description: 讲解了VxWorks开发环境Tornado2.2的基本应用方法。包括工程创建,config.h配置,编译器配置,FTP设置,组件配置,库文件生成,还有个互斥信号量的例子。-VxWorks development environment on a basic application Tornado2.2. Including works to create, config.h configuration, compiler configuration, FTP settings, component configuration, library file to generate, there is a mutually exclusive semaphore example.
Platform: |
Size: 12786688 |
Author: 马志昕 |
Hits:
Description: pthread.h
semaphore.h
pthread_mutex_t,PTHREAD_MUTEX_INITIALIZER, sem_t semaphore
Platform: |
Size: 1024 |
Author: mwmacleod |
Hits:
Description: 信号量PV操作的封装函数,包括一个.c文件和.h文件 用于进程间通信的同步.-simplified sem_wait and sem_post function
Platform: |
Size: 2048 |
Author: wu |
Hits:
Description: /* dma.h - DMA (direct memory access) header */
/* Copyright 1984-1992 Wind River Systems, Inc. */
/*
modification history
--------------------
01e,22sep92,rrr added support for c++
01d,04jul92,jcf cleaned up.
01c,26may92,rrr the tree shuffle
01b,04oct91,rrr passed through the ansification filter
-fixed #else and #endif
-changed copyright notice
01a,20dec90,jcc written.
*/
#ifndef __INCdmah
#define __INCdmah
#ifdef __cplusplus
extern "C" {
#endif
#include "vxWorks.h"
#include "private/semLibP.h"
typedef struct dmaCtrl /* DMA_CTRL - generic DMA controller info */
{
SEMAPHORE ctrlMutexSem -/* dma.h- DMA (direct memory access) header*/
/* Copyright 1984-1992 Wind River Systems, Inc.*/
/*
modification history
--------------------
01e,22sep92,rrr added support for c++
01d,04jul92,jcf cleaned up.
01c,26may92,rrr the tree shuffle
01b,04oct91,rrr passed through the ansification filter
-fixed#else and#endif
-changed copyright notice
01a,20dec90,jcc written.
*/
#ifndef __INCdmah
#define __INCdmah
#ifdef __cplusplus
extern "C" {
#endif
#include "vxWorks.h"
#include "private/semLibP.h"
typedef struct dmaCtrl /* DMA_CTRL- generic DMA controller info*/
{
SEMAPHORE ctrlMutexSem
Platform: |
Size: 1024 |
Author: liaozhigao |
Hits:
Description: 哲学家进餐问题
#include<stdio.h>
#include<semaphore.h>
#include<pthread.h>
//宏定义信号量个数为5,宏定义0表示思考,宏定义1表示饿,宏定义2表示吃,宏定义(ph_num+4) N表示左,宏定义(ph_num+1) N表示右
#define N 5
#define THINKING 0
#define HUNGRY 1
#define EATING 2
#define LEFT (ph_num+4) N
#define RIGHT (ph_num+1) N
//声明互斥锁 ,声明数组
sem_t mutex
sem_t S[N]
//声明操作函数,取叉函数,放叉函数,测试函数
void * philospher(void *num)
void takeFork(int)
void putFork(int)
void test(int)
int state[N] -the question about lunch
Platform: |
Size: 1024 |
Author: cc |
Hits:
Description: 读者写者问题C++解法,使用互斥信号量,写者线程优先,共有3个读者2个写者-Similar to the barbers problem,the program use semaphore to solve the reader/writer problem.Two semaphores are involved:m_h, h,used as a counter and mutex between 2 writers.Main function create 3 reader thread and 2 writer thread.The writer thread has a higher priority by using SetThreadPriority() function
Platform: |
Size: 1024 |
Author: huia85njg33 |
Hits: