Éú²úÕß Ïû·ÑÕßÎÊÌâʵÏÖ (linuxÏÂCÓïÑÔ)
²Ù×÷ϵͳµÄÒ»¸ö¾µäÎÊÌâÊÇ"Éú²úÕß-Ïû·ÑÕß"ÎÊÌâ, ÕâÉ漰ͬ²½ÐźÅÁ¿ºÍ»¥³âÐźÅÁ¿µÄÓ¦ÓÃ, ÔÚÕâÀï,ÎÒÓÃÏ̵߳Äͬ²½ºÍ»¥³âÀ´ÊµÏÖ.
/*
* author ÕÅÎÄ
* 2008/06/20
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <semaphore.h>
#define N 2 // Ïû·ÑÕß»òÕßÉú²úÕßµÄÊýÄ¿
#define M 10 // »º³åÊýÄ¿
int in = 0; // Éú²úÕß·ÅÖòúÆ·µÄλÖÃ
int out = 0; // Ïû·ÑÕßÈ¡²úÆ·µÄλÖÃ
int buff[M] = {0}; // »º³å³õʼ»¯Îª0£¬ ¿ªÊ¼Ê±Ã»ÓвúÆ·
sem_t empty_sem; // ͬ²½ÐźÅÁ¿£¬ µ±ÂúÁËʱ×èÖ¹Éú²úÕ߷ŲúÆ·
sem_t full_sem; // ͬ²½ÐźÅÁ¿£¬ µ±Ã»²úƷʱ×èÖ¹Ïû·ÑÕßÏû·Ñ
pthread_mutex_t mutex; // »¥³âÐźÅÁ¿£¬ Ò»´ÎÖ»ÓÐÒ»¸öÏ̷߳ÃÎÊ»º³å
int product_id = 0; //Éú²úÕßid
int prochase_id = 0; //Ïû·ÑÕßid
/* ´òÓ¡»º³åÇé¿ö */
void print()
{
int i;
for(i = 0; i < M; i++)
printf("%d ", buff[i]);
printf("\n");
}
/* Éú²úÕß·½·¨ */
void *product()
{
int id = ++product_id;
while(1)
{
// ÓÃsleepµÄÊýÁ¿¿ÉÒÔµ÷½ÚÉú²úºÍÏû·ÑµÄËٶȣ¬±ãÓÚ¹Û²ì
sleep(1);
//sleep(1);
sem_wait(&empty_sem);
pthread_mutex_lock(&mutex);
in = in % M;
printf("product%d in %d. like: \t", id, in);
buff[in] = 1;
print();
++in;
pthread_mutex_unlock(&mutex);
sem_post(&full_sem);
}
}
/* Ïû·ÑÕß·½·¨ */
void *prochase()
{
int id = ++prochase_id;
while(1)
{
// ÓÃsleepµÄÊýÁ¿¿ÉÒÔµ÷½ÚÉú²úºÍÏû·ÑµÄËٶȣ¬±ãÓÚ¹Û²ì
sleep(1);
//sleep(1);
sem_wait(&full_sem);
pthread_mutex_lock(&mutex);
out = out % M;
printf("prochase%d in %d. like: \t", id, out);
&nb
Ïà¹ØÎĵµ£º
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
¡¡¡¡ ¶àÏ̳߳ÌÐòÉè¼ÆµÄ¸ÅÄîÔçÔÚÁùÊ®Äê´ú¾Í±»Ìá³ö£¬µ«Ö±µ½°ËÊ®Äê´úÖÐÆÚ£¬UnixϵͳÖвÅÒýÈë¶àÏ̻߳úÖÆ£¬Èç½ñ£¬ÓÉÓÚ×ÔÉíµÄÐí¶àÓŵ㣬¶àÏ̱߳à³ÌÒѾµÃµ½Á˹㷺µÄÓ¦Óᣱ¾ÎÄÎÒÃǽ«½éÉÜÔÚLinuxϱàд¶à½ø³ÌºÍ¶àÏ̳߳ÌÐòµÄһЩ³õ²½ÖªÊ¶¡£
------------------------------------------------------------------------ ......
Ê×ÏÈÐèÒª°²×°Red5ÔËÐÐËùÐèµÄjava¿ª·¢»·¾³jdk,ÎÒËùÓеÄÎļþ¶¼±£´æµ½/root/download,°²×°ÒªÓÃroot
¡¡¡¡Óû§½øÐа²×°
¡¡¡¡ÏÂÔصØַΪhttps://sdlc6e.sun.com/ECom/EComActionServlet;jsessionid= 8CEC5D9DFF18A14B277B3C32456062B1ÎÒÏÂÔصÄÊÇÀàÐÍLinux RPM in self-extracting file µÄÎļþ£¬ÎļþÃûΪ
¡¡¡¡jdk-1_5_0_0 ......
Linux 2.6.19.x Äں˱àÒëÅäÖÃÑ¡Ïî¼ò½é
×÷Õߣº½ð²½¹ú
Code maturity level options
´úÂë³ÉÊì¶ÈÑ¡Ïî
Prompt for development and/or incomplete code/drivers ÏÔʾÉÐÔÚ¿ª·¢ÖлòÉÐδÍê³ÉµÄ´úÂëÓëÇý¶¯.³ý·ÇÄãÊDzâÊÔÈËÔ±»òÕß¿ª·¢Õß,·ñÔòÇëÎðÑ¡Ôñ
General setup
³£¹æÉèÖÃ
Local version - append to kernel release ÔÚÄÚº ......