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 &
Ïà¹ØÎÊ´ð£º
´ó¼ÒºÃ£º
ÎÒÏëʵÏÖ¼ì²âµ½²åÈëSD¿¨ºó×Ô¶¯½«SD¿¨¸ñʽ»¯µÄ¹¦ÄÜ£¬²»ÖªC/C++ÖÐÓÐûÓиñʽ»¯UÅ̵ĺ¯Êý£¿
ÁíÍ⣬ÎÒ²»ÏëʹÓÃSHFormatDrive£¬ÒòΪÕâ¸öº¯Êý»áµ¯³öÊÇ·ñÒª¸ñʽ»¯µÄÌáʾ¿ò£¬ÎÒÐèÒªµÄÊÇϵͳ×Ô¶¯¸ñʽ»¯£¬¶ø²Ù×÷Õß² ......
ÔÚ¸ùĿ¼/libÖдæ·ÅÒ»¸ölog.c£¬log.h£¬²¢ÓÃÏÂÃæµÄÓï¾ä£º
gcc -c log.c
ar crv liblog.a log.o
±àÒë³öÒ»¸öliblog.a¾²Ì¬¿â£¬È»ºóÔÚÎļþ¼Ð£º/testfileÖд´½¨Ò»¸ötest.cºÍtestc.c£¬test.cÖÐÒýÓÃÁËtestc.cÖж¨ÒåµÄ·½·¨ ......
ËÄÜ°ïÎÒ°ÑÏÂÃæÕâЩ´úÂë¸Ä³ÉVBÐÎʽµÄ£¬¶àлÁË£¬¼±ÓÃ~~
#include "stdlib.h"
#include "math.h"
#include "stdio.h"
float objfx(float x[]);
void constraint(float x[],float g ......
¹«Ë¾¿ª·¢Ò»¸ö´¥ÃþÆÁ³ÌÐò£¬ÎÒ¸ºÔðµÄÒ»¿é£¬ÊµÏÖÕâÑùÒ»¸ö¹¦ÄÜ£¬µ±Êó±êµã»÷´°¿ÚÖÐͼƬ£¨Ò»ÕÅͼ·Ö³É¼¸²¿·Ö£©µÄÆäÖÐÒ»²¿·Öʱ£¬½«Õⲿ·ÖͼƬ½ØÈ¡³öÀ´£¬µ¯³öеĴ°¿Ú£¬½«½ØÈ¡³öµÄͼƬÏÔʾ³öÀ´¡£ÎÒʹÓÃRectangeÀà¿ØÖÆÁË·µ»Ø£¬ ......