我通过socket接收来自C#的图像字节如下:
[u'69', u'20', u'80', u'1', u'69', u'20', u'80', u'7', u'255', u'217']
我想将这个数组保存为jpg,我使用PIL,但我不能这样做。
答案 0 :(得分:0)
开始于:
#include<stdio.h>
#include<pthread.h>
int done = 0;
pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t c = PTHREAD_COND_INITIALIZER;
void *thr2(void *arg) {
pthread_t self;
self=pthread_self();
pthread_mutex_lock(&m);
done = 1;
pthread_cond_signal(&c);
pthread_mutex_unlock(&m);
return NULL;
}
void *thr1(void *arg) {
pthread_t self;
self=pthread_self();
pthread_mutex_lock(&m);
while (done == 0)
{
pthread_cond_wait(&c, &m);
}
pthread_mutex_unlock(&m);
}
int main(int argc, char *argv[]) {
pthread_t p,q,r;
pthread_create(&q, NULL, thr1, NULL);
sleep(2);
pthread_create(&p, NULL, thr2, NULL);
pthread_create(&r, NULL, thr2, NULL);
pthread_join(p,NULL);
pthread_join(q,NULL);
pthread_join(r,NULL);
return 0;
}
如果你无法弄明白,请发布你遇到的问题。