linux Ïß³ÌÎÊÌâ - C/C++ / CÓïÑÔ
ÎÒÓà pthread_create ´´½¨Ò»¸öỊ̈߳¬»ñµÃÏØ³ÇµÄid;
idÊÇÈ«¾Ö±äÁ¿£¬ÎÒÏëÖÐÆäËûº¯ÊýÖÐÏû³ýÕâ¸öº¯Êý£¬ÇëÎÊÓ¦¸ÃÔõô×ö£¿
×îºÃÁгöÀý×Ó£¬Ð»Ð»¡£
û¿´Ã÷°×°¡....
void main()
{
pthread_t id;
_create(); //´´½¨Ïß³Ì
_del(); //ÈçºÎÔÚÕâÀï°ÑÏß³ÌÏûÃð£¿
}
_create()
{
pthread_create(&id,NULL...)
}
_del()
{
//????????????
}
int pthread_cancel (pthread_t thread);
Cancels the specified thread.
pthread_cancel º¯ÊýÖ»ÊÇÌá³öÒ»¸öÕâÑùµÄÇëÇ󣬵«²»Ò»¶¨ÄÜÖÕÖ¹Ị̈߳¬×îºÃÊÇÔÚÔÀ´µÄÏß³ÌÀïÃæ¸ã¸öÍ˳öÌõ¼þ
while(_run){
}
//ÆäËûÏß³Ì
//ÏȲ»¿¼ÂÇͬ²½ÎÊÌâ
_run = 0;
In the default circumstances, pthread_cancel will cause the thread specified by tid to behave as if it had called pthread_exit with an argument of PTHREAD_CANCELED. However, a thread can elect to ignore or otherwise control how it is canceled. Note that pthread_cancel doesn 't wait for the thread to terminate. It merely makes &
Ïà¹ØÎÊ´ð£º
ÇëÎÊVFPÖÐÈçºÎµ÷ÓÃC/C++º¯Êý£¿
ÄãÒªµ÷ÓÃʲô¹¦Äܵĺ¯Êý£¿Òª¿´¿´VFPÖÐÓÐûÓжÔÓ¦µÄº¯Êý£¬Èç¹ûÓоÍÊ¡×ÅÔÙµ÷ÓÃÁË¡£Èç¹ûûÓУ¬¿ÉÒÔ½«C/C++º¯Êýд¸öDLL»òFLL£¬È»ºóÔÚVFPµ÷Óü´¿É¡£
Ê®¶¹Èý ÀÏʦ£¬Ôõô²ÅÄÜÐÞ¸Ä×Ô¼ºµÄ ......
ÈçÌ⣬ÔÚWINDOWSµ×ϵÄCODE»á£¬µ«ÔÚLINUXϲ»ÖªµÀÈçºÎʵÏÖ£¬JSµÄ´úÂëÓ¦¸ÃÊDz»Ò»ÑùµÄ¡£ Çó½Ì¡£
·Ö²»¹»ÔÙ¼Ó¡£
http://topic.csdn.net/u/20100113/08/17ba1e71-4c33-43f6-91a5-0e031c86e5ed.html
linux ......
ËÄܰïÎÒ°ÑÏÂÃæÕâЩ´úÂë¸Ä³ÉVBÐÎʽµÄ£¬¶àлÁË£¬¼±ÓÃ~~
#include "stdlib.h"
#include "math.h"
#include "stdio.h"
float objfx(float x[]);
void constraint(float x[],float g ......
ÎÒ¸Õ°ÑÌ·ºÆÇ¿µÄµÚÈý°æµÄÊéѧÍ꣬ÎÒÖªµÀµÄÓÐC++£¬CºÍÖ¸Õë CȱÏݺÍÏÝÚå Cר¼Ò±ä³É£¬»¹ÓÐÊý¾Ý½á¹¹£¬ÎÒÏëÎÊÎÊÎÒÓ¦¸ÃÒÔʲô˳ÐòÀ´Ñ§ÄØ
CȱÏݺÍÏÝÚå Cר¼Ò±à³Ì
Êǽø½×µÄ£¬²»Óü±×Å¿´
ÖÁÓÚ
CºÍÖ¸Õë
Äã²»Àí½âÖ ......