我是Python新手,我现在正在学习操作员.我明白:
/运营商用于floating point division和//对integer division.例:
7//3 = 2
Run Code Online (Sandbox Code Playgroud)
并且7//-3=-3.为什么答案-3?
我被困在这里.
我正在学习Tanenbaum的Modern Operating systems中的线程和POSIX线程.这是我正在尝试的一个例子:
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
void *print_hello(void *tid)
{
printf("Hello..Greetings from thread %d\n",tid);
pthread_exit(NULL);
}
int main()
{
pthread_t threads[10];
int status,i=0;
// for(i=0;i<10;i++){
printf("Creating thread %d\n",i);
status = pthread_create(&threads[i],NULL,print_hello,(void*)i);
if(status != 0){
printf("Oops pthread_create returned error code %d\n",status);
exit(-1);
}
// }
exit(0);
Run Code Online (Sandbox Code Playgroud)
}
输出是:
Creating thread 0
Run Code Online (Sandbox Code Playgroud)
为什么不去我的start_routine,这是什么print_hello功能?这有什么不对?
提前致谢.