atomics.h may not be included from frontend code

Поиск
Список
Период
Сортировка
От Aleksander Alekseev
Тема atomics.h may not be included from frontend code
Дата
Msg-id 20180227134859.GD4023@e733.localdomain
обсуждение исходный текст
Ответы Re: atomics.h may not be included from frontend code  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
Hello hackers,

My colleague Anastasia Lubennikova and I were discussing a weird piece
of code in src/include/port/atomics.h:

```
#ifdef FRONTEND
#error "atomics.h may not be included from frontend code"
#endif
```

We tried to follow commit messages [1] and discussions [2]. However no matter
how you try to look on this code it's weird.

Basically it says that atomics are written the way that they can be used
from one code and can't be used from another. So if you want to write a
cross-platform parallel incremental backup tool (what Anastasia is
currently working on) you have to use C++ and std::atomic (since MS
doesn't develops C anymore) or write something like:

```
#undef FRONTEND
#include <atomics.h>
#define FRONTEND
```

We would like to know whether you share this concern and whether it
would be a good idea to try to refactor the code so that atomics could
be used not only from the backend.

[1]: https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=4eda0a64705
[2]: https://postgr.es/m/20150806070902.GE12214@awork2.anarazel.de

--
Best regards,
Aleksander Alekseev

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Victor Wagner
Дата:
Сообщение: Re: MSVC builld of 9.5.12 is broken?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: TODO item for broken \s with libedit seems fixed