programmer group

Store global variable attention points globally

Background: When making applets, there is a shop interface that calls on almost every page, so take it out and put it in App.js lower But in the process, take notes to save a complete picture. 1. Because only in App.js Down, the show interface is adjusted. On other subpages, global variables stored in the shop are used, so if this interface is not invoked successfully or asynchronously not synchronized quickly at this time, it will...

programmer group

pthread_cond_broadcast --- pthread_cond_signal --- pthread_cond_wait difference

1. Applicable to pthread_cond_broadcast 1. One producer has many consumers, and the producer can produce many products at one time. 2. Multiple producers and multiple consumers 3. Implementation of read-write lock (notify all readers after writing) //test.c #include<stdio.h> #include<unistd.h> #include<pthread.h> #define MAX_THREAD_NUM 5 pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t cond =...

programmer group

switch statement usage in C ා

1 not every case needs to contain break. If the case statement is empty, it can not contain break, and the control flow will continue the subsequent case until the break is encountered. char grade = 'C'; switch (grade) { case 'A': case 'B': case 'C': Console.WriteLine("CCC"); break; case 'D': Console.WriteLine("DDD"); break; default: Console.WriteLine("Invalid grades"); break; } Output CCC no matter grad = A or B...