|
Distributed operating systemsThe first call creates an identifier and allocates storage, the second assigns a pointer to a per-thread global variable, and the third allows the thread to read back a per-thread global variable value. Many computer scientists consider global variables to be in the same league as that all-time great pariah, the GOTO statement, so they would no doubt rejoice at the idea of making them cumbersome to use. (The author once tried to design a programming language with a IKNOWTHISISASTUPIDTHINGTODOBUTNEVERTHELESSGOTO LABEL; statement, but was forcibly restrained from doing so by his colleagues.) It can be argued that having per-thread global variables use procedure calls instead of language scoping rules, like locals and globals, is an emergency measure introduced simply because most programming languages do not allow the concept to be expressed syntactically. Call Description Keycreate Create a global variable for this thread Setspecific Assign a pointer value to a per-thred global variable Getspecific Read a pointer value from a per-thread global variable Fig. 10-10 ...» | Код для вставки книги в блог HTML
phpBB
текст
|
|